I would like to achieve something in wpf which not seems to be easy to me.
I want to change the outer border's CornerRadius
depending on the inner element's state. If the ToggleButton
's IsChecked
property is true
then change the CornerRadius of the outer element something different than the default one.
I tried - among a lot of other things - this:
<Border x:Name="rootElement"
CornerRadius="5">
<ToggleButton
x:Name="showAdditionalOptions">
...
</ToggleButton>
<Border.Style>
<Style TargetType="{x:Type Border}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsChecked, ElementName=showAdditionalOptions}" Value="True">
<Setter Property="CornerRadius" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
I want to change the CornerRadius of rootElements if IsChecked is true for showAdditionalOptions. I tried setting the trigger in the ToggleButtons Triggers parts (both Style.Triggers AND Template.Triggers) but from there I can't reach outer elements (TargetName does not work).