|
I have used another way, i have added condition to on move funcation its working fine..
thnxx
|
|
|
|
|
Is there any solution to apply template on selected item event instead of mouse over???
reply fast ..
|
|
|
|
|
hi
I want to add multiple layers on my Silverlight User Control like PhotoShop & Flash but dint get any solution for my problem
is there any solution ???
please let me know as soon as possible
thxxx
|
|
|
|
|
Every control has a Canvas.ZIndex property.
Check if this[^] z-index value is able to give you the layer effect.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Hy,
I'm new like Really new to WPF. No WPF at work.
Anyway I would really apreciate some good WPF book titles/names. And please no ... for Dummies.
Thakns in advance.
|
|
|
|
|
|
thanks. I bowsed throught it and it seems interestring.
|
|
|
|
|
There are some excellent articles here[^] on CodeProject for beginners in WPF; especially by Josh Smith & Sacha Barber. The book suggested by the previous poster is also worth investing in. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
Hello, I have created a new article
Automatic WPF mapping to Database (Access 07 edition)[^]
and I would improve some parts if it's possible, I created a list of controls,dependency properties,string like:
mapping.CustomAdd(C1_Name,TextBox.TextProperty,"Name");
where the third column is the name of a field and by reflection I get/set the value of the class. My question is:
Is too much overheard add dependency properties linked to fields of a custom class? The class has to inherit from control?
Any example of implementing it would be great, Thanks
|
|
|
|
|
Juan
I've added my comments against your article, but I'll reiterate here for anybody who doesn't go over. I'm surprised that this implementation doesn't use MVVM. It would be worth looking to put that into place to make things easier for yourself."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello I'm trying to format a DateTime in XMAL, I found one page that explains that but in my case is not usefull. I want to put a format to DateTime value when it is binding, I have this piece of code:
ToolTip Name="Tooltip1" Style="{StaticResource TooltipStyle}" Content="{Binding
Converter={StaticResource dataPointConverter},
ConverterParameter='Date:{#XValues:}{#NewLine}Measure: {#Value}'}" >
<ToolTip.RenderTransform>
<TransformGroup>
<ScaleTransform x:Name="ScaleTransofrm2"
CenterX="30" CenterY="20"/>
<RotateTransform x:Name="RotateTransform1"
CenterX="30" CenterY="0"/>
</TransformGroup>
The XValue is the value that I want to format (this is the datetime).
If someone knows how to do that, I will be appreciated.
Regards and thanks in advance.
|
|
|
|
|
You could put in some logic in your converter to format date values based on the converterparameter. Not a pretty way to do it, but it might work.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
I am getting the following exception when trying to save a canvas in a wpf xaml file.
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
The following is what I did:
I am having a canvas in a wpf window which contains a chart and some labels.
<Canvas x:Name="c1">
<chartingToolkit:Chart x:Name="Time_Distance_Graph" Width="1292" Height="800" Canvas.Left="2" Canvas.Top="50" BorderThickness="0" xmlns:chartingToolkit="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
<chartingToolkit:Chart.Resources>
<Style x:Key="LineDataPointStyle" TargetType="charting:LineDataPoint" xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit">
<Setter Property="Visibility" Value="Hidden"/>
</Style>
</chartingToolkit:Chart.Resources>
<chartingToolkit:Chart.Axes>
<chartingToolkit:LinearAxis Orientation="X" Maximum="48" Interval="1" Title="Time" Margin="0,20,0,0" Visibility="Hidden" Minimum="0" ShowGridLines="False" />
<chartingToolkit:LinearAxis Orientation="Y" Title="Distance" Maximum="35" Minimum="0" Interval="0.5" Visibility="Hidden" ShowGridLines="False" />
</chartingToolkit:Chart.Axes>
<chartingToolkit:Chart.LegendStyle>
<Style TargetType="Control">
<Setter Property="Width" Value="0"/>
<Setter Property="Height" Value="0"/>
</Style>
</chartingToolkit:Chart.LegendStyle>
<chartingToolkit:Chart.ChartAreaStyle>
<Style TargetType="Panel">
<Setter Property="Width" Value="1259"/>
<Setter Property="Height" Value="743"/>
</Style>
</chartingToolkit:Chart.ChartAreaStyle>
</chartingToolkit:Chart>
<Label Canvas.Left="1095" Canvas.Top="37.5" Height="25" Width="37.5" Content="Date:" Name="lblDate"/>
<Label ………………………/>
<Label ………………………/>
<Label ………………………/>
</Canvas>
And also from the code behind I am adding more labels and lines dynamically to the canvas according to the requirement.
When the save button is clicked.
The following code is set to be executed.
FileStream saveFile = new FileStream(filepath, FileMode.Create);
XamlWriter.Save(c1, saveFile);
How can I get rid of the above exception?
Expecting a soon reply.
Thanks in Advance.
|
|
|
|
|
I have a accordion control on which I have databound two properties from the database. One is Location and other is theatre. When the page loads, the accordion shows different locations for each of the theatres. Actually I want only a single location for the theatres which come under that theatre part.
The screen shot for reference is as follows
http://lh4.ggpht.com/_rZz85WGZ4Vg/S5UhufYlUZI/AAAAAAAAAWQ/zXZiG4HTV9o/myScree.JPG[^]
The XAML code for the accordion is as follows:
<br />
<layoutToolkit:Accordion HorizontalAlignment="Stretch" Grid.Row="1" VerticalAlignment="Stretch" Grid.RowSpan="2" Margin="0,0,0,40" BorderBrush="{x:Null}" x:Name="theatresAccordian"><br /><br />
<layoutToolkit:Accordion.ContentTemplate><<br />
<DataTemplate><br />
<TextBlock Text="{Binding Name}"/><br />
</DataTemplate><br />
</layoutToolkit:Accordion.ContentTemplate><br />
<layoutToolkit:Accordion.ItemTemplate ><br />
<DataTemplate><br />
<TextBlock x:Name="_headertext" Text="{Binding Location}"/><br />
</DataTemplate><br />
</layoutToolkit:Accordion.ItemTemplate><br />
</layoutToolkit:Accordion><br />
I have tried searching search engines but was in vain Always Keep Smiling.
Yours Pankaj Nikam
modified on Monday, March 8, 2010 11:23 AM
|
|
|
|
|
I have a WinForms app with an embedded WPF user control. The embedded WPF UserControl contains a ListView .
The application implements a List collection that MUST remain compatible with the already existing Winforms code (for various reasons that aren't important here, the list cannot inherit from IBindingList or ObservableCollection ). For this reason, the WPF ListView isn't updated when the contents of the list changes, which means (I think) that I'm relegated to adding/changing the items manually when they've changed.
Everything I've found on the web assumes that I'm using purely WPF (and an ObservableCollection), and thus assumes I'm using databinding (which I'm not, obviously).
I know how to add items to the ListView manually, but how do I tell the ListView columns what property to use from the added item?.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Why bind to the List itself when you can bind to an ObservableCollection and add and remove items to that ObservableCollection manually! and you should make that ObservableCollection of a ViewModel of the actual list items. I think that should work the way you want.
About setting the property to use for the ListView columns, use the DisplayMemberBinding of the GridViewColumn . It works even when adding items manually to the ListView 's Items property.Eslam Afifi
|
|
|
|
|
I already said I cannot use ObservableCollection because that will break the winforms code that uses the list..45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: the list cannot inherit from IBindingList or ObservableCollection
I didn't say you should inherit from ObservableCollection. I said,
Eslam Afifi wrote: bind to an ObservableCollection and add and remove items to that ObservableCollection manually
Maybe I wasn't clear enough. In this case, I'm sorry. But I meant to bind to an ObservableCollection not the List in question. Something like that,
List<A> _aModels = new List<A>();
ObservableCollection<AViewModel> _aViewModels = new ObservableCollection<AViewModel>();
var aModel = new A { X = _random.Next(), Y = _random.Next(), Z = _random.Next() };
_aModels.Add(aModel);
_aViewModels.Add(new AViewModel(aModel));
As for setting which property to use of columns. It works even when adding items manually to the ListView's Items property and not using ItemsSource.
ItemsSource
<ListView.View>
<GridView>
<GridView.Columns>
<!-- the ViewModel exposes the X, Y and Z properties -->
<GridViewColumn Header="X" DisplayMemberBinding="{Binding X}" Width="100" />
<GridViewColumn Header="Y" DisplayMemberBinding="{Binding Y}" Width="100" />
<GridViewColumn Header="Z" DisplayMemberBinding="{Binding Z}" Width="100" />
</GridView.Columns>
</GridView>
</ListView.View>
I replied to your question based on what I understood from it. You said you can't inherit from ObservableCollection and I don't think using a separate object of ObservableCollection would break the compatibility with the already existing windows forms code. If you mean you can't even use a separate instance of ObservableCollection because it breaks existing code, why would it break the code?Eslam Afifi
|
|
|
|
|
You've added an ObservableCollection when it's not needed. You can bind directly to a generic list, so adding the binding to the ObservableCollection is unecessary; the only reason to bind to ObservableCollection is to receive notifications when the list changes, which you can mimic without an ObservableCollection (after all, you're maintaining the same list twice here).
As an item is added to the List, all you need to do is raise a CollectionChanged event when an item is added or removed from the list."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Yes, you are right. I'm aware of that, that's why I mentioned that the DisplayMemberBinding works when adding items to the Items manually. I tried both ways in a sample code before I first replied.
This has just popped into my mind while I was reading your post, if it's not possible to make the List implement the INotifyCollectionChanged (If it's a class that inherits from List, which is what I understood from the question and the class is not to be touched. But I don't think implementing the interface would break existing code) then maybe creating a wrapper for (or inheriting from) the List (a custom List or just a List), implementing INotifyCollectionChanged and substituting the List with its wrapper (which would be implementing the interfaces of the original List) would be a better option. I haven't thought much about it and I'm interested to know what you think about it.Eslam Afifi
|
|
|
|
|
That would work. I'm currently writing an extended version of ObservableCollection that supports undo functionality, and it's simply a Collection wrapped up using INotifyCollectionChanged."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Nice. I'm looking forward to seeing it. Eslam Afifi
|
|
|
|
|
I'm pretty damned sure that John said he couldn't use an ObservableCollection, and he explained why he couldn't use it so your post added nothing to his question."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
John - you only need an ObservableCollection if you want to catch notification changes. In this case, you'd bind to the properties in exactly the same way you'd bind to an ObservableCollection. Here's a quick sample I whipped together for you:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BindToList
{
public partial class Window1 : Window
{
private List<MyListItem> _list;
public Window1()
{
InitializeComponent();
_list = new List<MyListItem>();
AddItem("John", "Simmons");
AddItem("Pete", "O'Hanlon");
AddItem("Clint", "Eastwood");
foreach (MyListItem item in _list)
{
listBound.Items.Add((MyListItem)item);
}
}
public List<MyListItem> MyList
{
get { return _list; }
set { _list = value; }
}
public void AddItem(string forename, string surname)
{
_list.Add(new MyListItem { ID = _list.Count + 1, Forename = forename, Surname = surname });
}
}
public class MyListItem
{
private int _id;
public int ID
{
get { return _id; }
set { _id = value; }
}
private string _forename;
public string Forename
{
get { return _forename; }
set { _forename = value; }
}
private string _surname;
public string Surname
{
get { return _surname; }
set { _surname = value; }
}
}
} Now, here's the XAML that goes with this:
<Window x:Class="BindToList.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<DataTemplate x:Key="myListTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding ID}" />
<TextBlock Text="{Binding Forename}" />
<TextBlock Text="{Binding Surname}" />
</StackPanel>
</DataTemplate>
</Window.Resources>
<Grid>
<ListBox x:Name="listBound"
ItemTemplate="{StaticResource myListTemplate}"
Width="200" />
</Grid>
</Window> "WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hello all,
I am quite new in wpf and i am having some problem in displaying
an System.Windows.forms.Form as child of my WPF main window
I have a WPF application opening some system.windows.forms.form from WPF menu
but the problem is i am unable to make those winforms as child of WPF Main Window
because of which i cant show the winform as center parent.
Can anybody help me out how to make the WPF Window parent of the windows.forms.formabhinav
|
|
|
|