DataTrigger sets the default value when the condition is false
Asked Answered
S

1

7

So here is my XAML:

<Ellipse Height="100" Width="100" Margin="35,112,0,0" Name="ellipse1" Fill="Red">
        <Ellipse.Style>
            <Style TargetType="Ellipse">
                <Style.Triggers>
                    <DataTrigger Binding="{Binding ElementName=checkBox1, Path=IsChecked}" Value="true">
                        <Setter Property="Ellipse.Visibility" Value="Collapsed"></Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>
        </Ellipse.Style>
    </Ellipse>
    <CheckBox Content="CheckBox" Height="16" Margin="42,79,168,166" Name="checkBox1" />

When the checkbox is checked, of course the ellipse disappears but when it's unchecked, it appears again, but i don't know why. This behavior is normal? Why this is happening?

Solent answered 14/1, 2011 at 11:13 Comment(0)
S
5

Trigger restores original value of property.

About trigger and value

Surrebuttal answered 14/1, 2011 at 11:40 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.