Hi, I am trying to add a storyBoard to my stack panel and bind the trigger to a code behind property, but the stackpanel is not responding to the property changes. here is the code:
<Window x:Class="DirectAccess.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DirectAccess"
Title="MainWindow" Height="520" Width="250"
x:Name="Main">
<StackPanel Orientation="Horizontal" >
<StackPanel.Style>
<Style>
<Style.Triggers>
<Trigger Property="local:MainWindow.IsLogged" Value="false">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetProperty="Width"
From="250"
To="800"
Duration="0:0:1"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Style>
</StackPanel>
</Window>
and the code behind property :
public static readonly DependencyProperty IsLoggedProperty = DependencyProperty.Register("IsLogged", typeof(bool), typeof(MainWindow));
public bool IsLogged
{
get { return (bool)GetValue(IsLoggedProperty); }
set { SetValue(IsLoggedProperty, value); }
}
where is the problem...? In fact the storyboard is only performing on application load, but when i set IsLogged property to 'true' on application load, and set it to false afterwards, the application doesn't respond.
thank you in advance.