I am trying to tag a control when it becomes visible. The next one compiles and works fine, it just doesn't disappear (control instantly pops up when IsActive is set to true)
<UserControl x:Class="blah" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:util="clr-namespace:blah.Util" mc:Ignorable="d" d:DesignHeight="250" d:DesignWidth="400"> <UserControl.Resources> <util:BooleanToVisibilityConverter x:Key="BoolToVis" /> <Style TargetType="UserControl"> <Style.Triggers> <Trigger Property="Visibility" Value="Visible"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.0" To="1.0" Duration="0:0:1.25" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> </Trigger> </Style.Triggers> </Style> </UserControl.Resources> <UserControl.Visibility> <Binding Path="IsActive" Converter="{StaticResource ResourceKey=BoolToVis}" ConverterParameter="False" /> </UserControl.Visibility> </UserControl>
Firstly, I would appreciate it if someone could tell me why this is not working.
Secondly, I was wondering if there is a way to debug such things, since I often try to get triggers to work properly. Currently my debugging is to look at XAML to try to see if the bits are changing incorrectly or accidentally in order to narrow the scope.
What I really want to do is set a breakpoint on the <Trigger Property="Visibility" Value="Visible"> bit to see if this starts as a starting point. Obviously, I cannot do this, but I was wondering if there is a way to do a more structured debugging, rather than my current random attempt on an empty wall .: - /
source share