通过简单地绑定控件的IsEnabled属性,我可以让这个功能与文本框和组合框一起工作,我想一直隐藏,直到有东西被选中。比如文本,所以:
<Label Content="Please Select the status for this client:" Margin="0,0,65,0" IsEnabled="{Binding CBCustomer.Text}" />
因此,基本上,这个项目将不会显示,直到有人在组合框中选择的东西。
如何使用一组单选按钮获得相同的功能?基本上,我有一个stackpanel,我希望IsEnabled属性(显示为XXXXXX)绑定到一个布尔值,该值表示是否选择了任何按钮。
<StackPanel Orientation="Horizontal" Canvas.Left="54" Canvas.Top="40" Margin="0,0,0,50">
<Label Content="Please Select the RAG Status for this client:" Margin="0,0,65,0" IsEnabled="{Binding CBCustomer.Text}" />
<RadioButton GroupName="RAGGroup" Margin="0,8,0,0" Background="Red" Foreground="Red" IsEnabled="{Binding CBCustomer.Text}">Red</RadioButton>
<RadioButton GroupName="RAGGroup" Margin="10,8,0,0" Background="DarkGoldenrod" Foreground="DarkGoldenrod" IsEnabled="{Binding CBCustomer.Text}">Amber</RadioButton>
<RadioButton GroupName="RAGGroup" Margin="10,8,0,0" Background="Green" Foreground="Green" IsEnabled="{Binding CBCustomer.Text}">Green</RadioButton>
</StackPanel>
<StackPanel Margin="55,80,0,0" IsEnabled="{Binding XXXXXXX}">
使用多重绑定?我看到了一些例子,展示了如何从选中的按钮中获取值,但我不关心这一点,我只需要看看值是否被选中。