Is it possible to 'refresh' WPF data bindings

后端 未结 3 1191
心在旅途
心在旅途 2020-12-18 09:52

I\'ve got a xaml TabControl and on one page, there are 3 RadioButtons each bound to a different property on the selected value of an adjacent ListView. After switching betwe

相关标签:
3条回答
  • 2020-12-18 10:25

    This is apparently somewhat of a known issue:

    http://social.msdn.microsoft.com/forums/en-US/wpf/thread/8eb8280a-19c4-4502-8260-f74633a9e2f2/

    In short, a RadioButton (through .Net 3.5sp1) somehow kills bindings of other RadioButtons when when it's checked while trying to uncheck any other buttons. The simple fix (read: hack) is to assign each radiobutton a different GroupName and then they don't try to mess with eachother

    0 讨论(0)
  • 2020-12-18 10:32

    Another way to resolve this issue is to fake up a list of properties in a ListBox and have the ListBoxItem template be a radiobutton.

    0 讨论(0)
  • 2020-12-18 10:48

    It is possible to manually update bindings like this:

    TestCheckBox
        .GetBindingExpression(CheckBox.IsCheckedProperty)
        .UpdateTarget();
    

    That being said, I don't have 100% confidence that this will correct your underlying issue. I haven't had this sort of issue before with WPF bindings, but I have had a couple weird issues with the tab control.

    0 讨论(0)
提交回复
热议问题