Reputation: 335
I am using a converter
<Window.Resources>
<BooleanToVisibilityConverter x:Key="convVisibility"/>
</Window.Resources>
I Have 3 radio buttons:
<RadioButton Content="PRE" GroupName="Env" Height="16" HorizontalAlignment="Left" Margin="492,167,0,0" Name="radioButton4" VerticalAlignment="Top" />
<RadioButton Content="POST" GroupName="Env" Height="16" HorizontalAlignment="Left" Margin="558,167,0,0" Name="radioButton5" VerticalAlignment="Top" />
<RadioButton Content="BOTH" GroupName="Env" Height="16" HorizontalAlignment="Left" Margin="632,167,0,0" Name="radioButton6" VerticalAlignment="Top" />
I have a label that I am trying to make visible if either radioButton4 or radioButton6 are selected. Currently can get it to work with 4 using this.
<Label Content="PRE" Visibility="{Binding IsChecked, ElementName=radioButton4, Converter={StaticResource convVisibility}}" Height="28" HorizontalAlignment="Left" Margin="57,262,0,0" Name="label7" VerticalAlignment="Top" />
is there a way to add a second binding to the label or am I SOL, I have tried googling this for the past hour or so and expected it to be something simple, is it doable?
Upvotes: 1
Views: 1691
Reputation: 185290
You could use a MultiBinding
with a custom converter that OR
's the imput values from the bindings to the two RadioButtons
.
<Label.Visibility>
<MultiBinding>
<MultiBinding.Converter>
<local:LogicalOrConverter />
</MultiBinding.Converter>
<Binding Path="IsChecked" ElementName="radioButton4"/>
<Binding Path="IsChecked" ElementName="radioButton6"/>
</MultiBinding>
</Label.Visibility>
Upvotes: 2