WPF绑定到My.Settings的单选按钮(使用vb.net)
遵循WPF Binding My.Settings集合中的建议到Combobox项目
我能够绑定工作的复选框,但不是单选按钮?
保存MySettings后,复选框值为true或false,取决于复选框是否被选中(如预期),而单选按钮总是返回true。
任何洞察到我做错了什么,或者这是一个错误?
(ps:我发现了一个工作,但...)
xmlns:self="clr-namespace:myprog"
<CheckBox Name="cbStartDocked" IsChecked="{Binding Source={x:Static self:MySettings.Default}, Path=StartDocked}" Margin="8,0,20.706,39" Height="21" VerticalAlignment="Bottom">Start doc_ked</CheckBox>
<RadioButton Name="rbDockLeft" IsChecked="{Binding Source={x:Static self:MySettings.Default}, Path=DockLeft}" Margin="25,0,24,24" Height="16" VerticalAlignment="Bottom">Dock _left</RadioButton>
<RadioButton Name="rbDockRight" IsChecked="{Binding Source={x:Static self:MySettings.Default}, Path=DockRight}" Margin="25,0,33,2" Height="16" VerticalAlignment="Bottom">Dock _right</RadioButton>
设置应该是正确的,正确的大小写,所有布尔型的所有用户范围,默认值为true或false
在这里,为了他人的利益,我申请的工作是:
Private Sub rbDockLeft_Checked(ByVal sender As Object,ByVal e As System.Windows.RoutedEventArgs)Handle rbDockLeft.Checked
My.Settings.DockLeft = True
My.Settings.DockRight = False
结束小组
Private Sub rbDockLeft_Unchecked(ByVal sender As Object,ByVal e As System.Windows.RoutedEventArgs)处理rbDockLeft.Unchecked
My.Settings.DockLeft = False
My.Settings.DockRight = True
结束小组
链接地址: http://www.djcxy.com/p/44661.html上一篇: WPF binding to My.Settings for radiobuttons (using vb.net)
下一篇: How to scroll a ListViewItem to the top of the ListView