RE: A typical few hours
This is a common problem. Same in WPF as well. My work around, for cases where I desperately want radiobuttons, is the following. 1. Create your radiobuttons,each with a different groupname. 2. Bind each radiobutton to a different property and manually set the other properties to false when one of the others is true. After 6 months I fell for this trap again this morning (in a WPF app). I called CancelEdit on an IEditableObject and everything in the UI reverted except the radio buttons. After sticking some displays on the property setter I saw it flipping back and forth between values and then I remembered this thread in the Silverlight forum. I found that putting a different GroupName on the radio buttons was sufficient, no need to bind to different properties. I'm using a typical Enum-RadioButton converter that you see all over the place. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: A typical few hours
This is a common problem. Same in WPF as well. My work around, for cases where I desperately want radiobuttons, is the following. 1. Create your radiobuttons,each with a different groupname. 2. Bind each radiobutton to a different property and manually set the other properties to false when one of the others is true. Here is an example that works, you should be able to figure it out : private bool _IsAsset; public bool IsAsset { get { return _IsAsset; } set { if (value & _IsAsset != value) { _IsTrailer = false; _IsUnknown = false; OnPropertyChanged("IsTrailer"); OnPropertyChanged("IsUnknown"); } _IsAsset = value; OnPropertyChanged("IsAsset"); } } private bool _IsTrailer; public bool IsTrailer { get { return _IsTrailer; } set { if (value & _IsTrailer != value) { _IsAsset = false; _IsUnknown = false; OnPropertyChanged("IsAsset"); OnPropertyChanged("IsUnknown"); } _IsTrailer = value; OnPropertyChanged("IsTrailer"); } } On Fri, Jul 22, 2011 at 5:50 PM, Greg Keogh wrote: > Winston, no binding errors in the output window. It’s a plain class that > implements INotifyPropertyChanged. > > ** ** > > Jake, don’t tell me ... someone (you!) has suffered this before, and I > didn’t run the correct web searches, and I wasted my time while wasting > time. I see your post now, but I’ve got to cook dinner, so I’ll come back > and digest it later (after the food). At a glance, your description matches > my symptoms. > > ** ** > > Greg > > ___ > ozsilverlight mailing list > ozsilverlight@ozsilverlight.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: A typical few hours
Winston, no binding errors in the output window. It's a plain class that implements INotifyPropertyChanged. Jake, don't tell me ... someone (you!) has suffered this before, and I didn't run the correct web searches, and I wasted my time while wasting time. I see your post now, but I've got to cook dinner, so I'll come back and digest it later (after the food). At a glance, your description matches my symptoms. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
RE: A typical few hours
I know exactly the problem you are having because I have had the same issues before, see my blog post at http://jake.ginnivan.net/radiobuttonbindings The problem is the implementation of the radio buttons. When I check one of them, it will search for other radiobuttons in the same group (inside parent containers visual tree I think), and will clear the value. This clears your binding =( My blog post has the workaround that I have used. Regards, Jake Ginnivan Readify | Senior Developer | MVP (VSTO) M: +61 403 846 400 | E: jake.ginni...@readify.net<mailto:jake.ginni...@readify.net> | W: www.readify.net<http://www.readify.net/> From: ozsilverlight-boun...@ozsilverlight.com [mailto:ozsilverlight-boun...@ozsilverlight.com] On Behalf Of Greg Keogh Sent: Friday, 22 July 2011 3:00 PM To: 'ozSilverlight' Subject: A typical few hours So I have a plain class object as the DataContext for a UserControl with a variety of controls on it. All of the two-way binding works perfectly except for a group of 3 radio buttons which seem to change their checked states in an incomprehensible random way. For over 3 hours I stick debug displays into every crack I can find, I swap code in and out, I try it on different controls, I fiddle with the bool-enum converter, but absolutely nothing makes any difference. Similar radio buttons on another similar control work perfectly, only this one is stuffed. I eventually deleted all binding code for the radio buttons and used an old WinForms style get/set property and it works. I think this is a really typical case of what I've been complaining about for two years now, and it's getting worse. As my working days pass, more and more roadblocks, workarounds, gotchas and bugs degrade my work satisfaction and income. Most of this suffering continues to come from Silverlight, WPF and WCF. NRN, I'm just venting my boiling spleen. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
Re: A typical few hours
Greg, So the plain class implements INotifyPropertyChanged and explicitly raises property changes on those bound values? What are the properties you're binding to? No binding errors at all in the output? On Fri, Jul 22, 2011 at 5:00 PM, Greg Keogh wrote: > So I have a plain class object as the DataContext for a UserControl with a > variety of controls on it. All of the two-way binding works perfectly except > for a group of 3 radio buttons which seem to change their checked states in > an incomprehensible random way. For over 3 hours I stick debug displays into > every crack I can find, I swap code in and out, I try it on different > controls, I fiddle with the bool-enum converter, but absolutely nothing > makes any difference. Similar radio buttons on another similar control work > perfectly, only this one is stuffed. > > ** ** > > I eventually deleted all binding code for the radio buttons and used an old > WinForms style get/set property and it works. > > ** ** > > I think this is a really typical case of what I’ve been complaining about > for two years now, and it’s getting worse. As my working days pass, more and > more roadblocks, workarounds, gotchas and bugs degrade my work satisfaction > and income. Most of this suffering continues to come from Silverlight, WPF > and WCF. > > ** ** > > NRN, I’m just venting my boiling spleen. > > ** ** > > Greg > > ___ > ozsilverlight mailing list > ozsilverlight@ozsilverlight.com > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight > > ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
A typical few hours
So I have a plain class object as the DataContext for a UserControl with a variety of controls on it. All of the two-way binding works perfectly except for a group of 3 radio buttons which seem to change their checked states in an incomprehensible random way. For over 3 hours I stick debug displays into every crack I can find, I swap code in and out, I try it on different controls, I fiddle with the bool-enum converter, but absolutely nothing makes any difference. Similar radio buttons on another similar control work perfectly, only this one is stuffed. I eventually deleted all binding code for the radio buttons and used an old WinForms style get/set property and it works. I think this is a really typical case of what I've been complaining about for two years now, and it's getting worse. As my working days pass, more and more roadblocks, workarounds, gotchas and bugs degrade my work satisfaction and income. Most of this suffering continues to come from Silverlight, WPF and WCF. NRN, I'm just venting my boiling spleen. Greg ___ ozsilverlight mailing list ozsilverlight@ozsilverlight.com http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight