|
Does it work if you implement your Colour class something like this?
public class Colour
{
public string Description { get; set; }
public override bool Equals(object obj)
{
return this.Description == (obj as Colour).Description;
}
public override int GetHashCode()
{
return base.GetHashCode() ^ this.Description.GetHashCode();
}
}
...and your SelectedColour dependency property:
public static DependencyProperty SelectedColourProperty =
DependencyProperty.Register("SelectedColour", typeof(Colour), typeof(ViewModel));
public Colour SelectedColour
{
get { return (Colour)GetValue(SelectedColourProperty); }
set { SetValue(SelectedColourProperty, value); }
}
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Many thanks for your reply.
That still does not do what i want, i am starting to think that i am going about this the wrong way
Put simply what i need is a combobox with a datasource of list of my objects (all the same type). Then when the form loads i want the combobox to have preselected an object of my choice (what ever was saved in xml/db)
I am new to wpf and the mvvm pattern, and this is getting a bit frustrating!!
ps for info i changed the colour class to the following as the other throw an exception
public class Colour
{
public string Description { get; set; }
public override bool Equals(object obj)
{
if(obj.GetType()== typeof(Colour))
return this.Description == ((Colour) obj).Description;
return base.Equals(obj);
}
public override int GetHashCode()
{
return base.GetHashCode() ^ this.Description.GetHashCode();
}
}
|
|
|
|
|
I want creat a Analog Clock in WPF. Help me! Please, Thanks so much.
|
|
|
|
|
A simple search would have found this[^].
"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
|
|
|
|
|
Hi,
I am developing one application using silverlight and .Net.There are some videos to watch.There are some features like rotate,scaling video using silverlight.Now I want to develop feature Throw videos using silverlight like in the following site.
http://www.etsy.com/color.php?ref=fp_nav_colors.If u open that link there are some bubbles,if you click those bubles you will find some images.In that we can throw those images to anywhere. I want to develop that feature using silverlight in my site.Can please anyone help me how to do that task using silverlight and .Net.
Thanks in advance
Pavani
|
|
|
|
|
pavanip wrote: Can please anyone help me how to do that task using silverlight and .Net.
you can consider hiring some Silverlight consultants to get it done.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
Microsoft MVP (Silverlight), WPF/Silverlight Insiders
|
|
|
|
|
I have a MFC dll, which one inherit the CFormView and I add a textbox in that FormView. I want to load that dll from WPF and display it in the window as a control. If anyone have an idea about this, please help me.
|
|
|
|
|
Why would you want to do this? It's easy enough (i.e. trivial) to do exactly this in WPF, so why would you want to go to all the trouble of adding in an external DLL to do this? BTW - I'm not the one who voted 1.
"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
|
|
|
|
|
Hi All,
I've just started looking into this in relation to an app I've made. It's a fairly simple app, most of the pages just have a handful of controls (the main one being Infragistics Grid) spread over a few pages. The app has been designed and implemented using Prism (Composite).
When I first launch the app I'm seeing nearly 60Mb of ram in use before the application has opened any data files. I'm currently going through the WPF Performance Suite tools to see what this shows up. Any tips would be good!
Anyone else experiencing anything like this with their apps?
|
|
|
|
|
It is normal. See comments here.[^]
|
|
|
|
|
Interesting comments. I had bookmarked that article but it had slipped my mind, thanks for pointing me to it.
|
|
|
|
|
I'm stuck (as usual).
A have a user control with 6 textboxes. But to make it easier, I'm trying to break down the problem a bit and lets say there is one textbox.
USERCONTROL1.XAML:CS
public partial class AttenuationBox : UserControl
{
private String justAtest;
public String ATest { get { return justATest; } set { ...
public String LowChRx
{
get { return tbLowChRX.Text; }
set { tbLowChRX.Text = value; }
}
...
}
USERCONTROL1.XAML
<textbox name="tbLowChRX" text="{Binding Path=ATest}"></textbox>
Now I want tbLowChRX to be bound to justAtest. But just can't get it to work. Must be something I have missed in Source or Path or...
modified on Sunday, April 19, 2009 12:49 PM
|
|
|
|
|
You will need to make sure the source is right on the binding.
Here's a simple example of one way to do it:
WPF: Binding to Properties in your UserControl or Window[^]
I'm not sure why you'd want to bind directly to the field, nor do I think
you can, but you should be able to bind to the ATest property. Of course, for
change notifications when the property is updated, you may want to make that a
dependency property.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oh, my fault, the intention was to bind to the property
|
|
|
|
|
Then that example at the link works...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello Friends I am getting these errors in my wpf application. Any help would be appreciated as I am totally new to this environment/
Error 1 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'AddNew' and no extension method 'AddNew' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 77 29 WpfMasterDetail_CS
Error 2 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'CommitNew' and no extension method 'CommitNew' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 78 29 WpfMasterDetail_CS
Error 3 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'RemoveAt' and no extension method 'RemoveAt' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 89 29 WpfMasterDetail_CS
Error 4 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'AddNew' and no extension method 'AddNew' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 121 29 WpfMasterDetail_CS
Error 5 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'CommitNew' and no extension method 'CommitNew' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 122 29 WpfMasterDetail_CS
Error 6 'System.Windows.Data.BindingListCollectionView' does not contain a definition for 'RemoveAt' and no extension method 'RemoveAt' accepting a first argument of type 'System.Windows.Data.BindingListCollectionView' could be found (are you missing a using directive or an assembly reference?) D:\Other\Personal\WPF\Tutorial\Windows Client\Zip Files\Wpf-Data-MasterDetail_CS\WpfMasterDetail_CS\WpfMasterDetail_CS\Window1.xaml.cs 129 33 WpfMasterDetail_CS
|
|
|
|
|
I have a MFC dll, which one inherit the CFormView and I add a textbox in that FormView. I want to load that dll from WPF and display it in the window as a control. If anyone have an idea about this, please help me.
|
|
|
|
|
|
I am implementing a scenario where I'm loading 3 or 4 views inside the tabcontrol. My tabcontrol region is defined using the TabControlRegionAdapter. I am able to load these views into this region without any problems. However, I am unable to control the layout of the tab control once these views get loaded. Thus my views scroll out of my page (so to speak) and are not visible on the screen. I understand that the tab control uses ItemsControl to display its content. I tried defining the layout using ItemsTemplate but even that seemed to have no effect.
How can I control the layout of the content inside a tab so that all my views can be completely visible on the screen? Also, is there a solution such that as I resize my browser, this content too gets automatically resized? In my present scenario, as I resize my window, more and more of my view content gets clipped.
Thanks for any help or guidance in advance.
|
|
|
|
|
I am working in WPF. Normally on lost focus of textbox , text are unselected. But if I set the value e.handled = true on lostfocus event handler, unselection doesn't happen. I need to set e.handled = true to prevent the event from bubbling up. Note: I am not stopping from lostfocus being triggered. LostFocus takes place, its just that, automatic unselection doesn't happen and I want the unselection to take place.
Private Sub MyTextBox_LostFocus(ByVal sender As Object, ByVal e As RoutedEventArgs)
e.Handled = True
End Sub
|
|
|
|
|
Try setting the TextBox.SelectionLength property to 0 in your LostFocus handler method.
|
|
|
|
|
Well setting that only leaves the textedit cursor blinking in the text box even after lost focus. I have already tried via default selection property settings e.g selectionlength or selectionstart, all results in setting the cursor blinking in the text box even if the next control get focus. Just tab through the text box and see the behviour of the cursor on txtFirst and txtSecond
< textbox x:name="txtTest" lostfocus="txtFirst_LostFocus" xmlns:x="#unknown" / >
< textbox x:name="txtFirst" lostfocus="txtFirst_LostFocus" xmlns:x="#unknown" / >
< textbox x:name="txtSecond" lostfocus="txtSecond_LostFocus" xmlns:x="#unknown" / >
< textbox x:name="txtFourth" xmlns:x="#unknown" / >
Private Sub txtFirst_LostFocus(ByVal sender As Object, ByVal e As RoutedEventArgs)
e.Handled = True
End Sub
Private Sub txtSecond_LostFocus(ByVal sender As Object, ByVal e As RoutedEventArgs)
e.Handled = True
End Sub
|
|
|
|
|
I see what you are saying about the caret staying in the TextBox that looses focus. Try setting the IsEnabled property to False and then True again after you set e.Handled = True. That seems to make the caret go away for me.
|
|
|
|
|
Hi all,
I want to download xml or any other file from physical location like C:\Documents and Settings\All Users\Documents\Test.xml and open a Save Dialog box to allow user to save it in desired location
Is it possible in Silverlight 2.0?
Can we do it in xaml.cs file?
If yes then plz share the code with me.....
Its very urgent.........
Thanks in advance,
|
|
|
|
|
salon wrote: Is it possible in Silverlight 2.0?
Opening a file you can do using the OpenFileDialog class, so the user
effectively needs to give permission first.
Saving a file, no, not in Silverlight 2.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|