Hello, I have a DocumentHeaderTemplate with animation style to flash the document tab based on the value of a dependency property. This works when the document is docked to the main window however when undocked it does not work. Does anyone have any idea on what I could try to maintain the flashing tab even when the document window is undocked?
The code is below, why doesn't this work?
{
public class AirportCode
{
public class AirportCodeDataSource : DependencyObject
{
The code is below, why doesn't this work?
<ad:DockingManager Grid.Row="1" >
<ad:DockingManager.DocumentHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Title}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="Background">
<Setter.Value>
<SolidColorBrush Color="Transparent"/>
</Setter.Value>
</Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.HasProblem}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard Name="StartBlinking">
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Background).(SolidColorBrush.Color)" To="Orange" Duration="00:00:00.4" RepeatBehavior="Forever" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Window}, Path=DataContext.HasProblem}" Value="False">
<DataTrigger.EnterActions>
<RemoveStoryboard BeginStoryboardName="StartBlinking"/>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</StackPanel>
</DataTemplate>
</ad:DockingManager.DocumentHeaderTemplate>
<ad:LayoutRoot>
<ad:LayoutPanel Orientation="Horizontal">
<ad:LayoutDocumentPaneGroup>
<ad:LayoutDocumentPane>
<ad:LayoutDocument Title="Airport Code">
<StackPanel>
<DataGrid ItemsSource="{Binding View}" />
</StackPanel>
</ad:LayoutDocument>
</ad:LayoutDocumentPane>
</ad:LayoutDocumentPaneGroup>
</ad:LayoutPanel>
</ad:LayoutRoot>
</ad:DockingManager>
public partial class Window5 : Window{
public AirportCodeDataSource AirportCodeDataSource { get { return this.DataContext as AirportCodeDataSource; } }
public Window5()
{
InitializeComponent();
this.DataContext = new AirportCodeDataSource();
this.AirportCodeDataSource.HasProblem = true;
}
}public class AirportCode
{
public string Name { get; set; }
public bool Operational { get; set; }
}public class AirportCodeDataSource : DependencyObject
{
public AirportCodeDataSource()
{
this.View = new ObservableCollection<AirportCode>
{
new AirportCode {Name = "JFK", Operational = true},
new AirportCode {Name = "LHR", Operational = true},
new AirportCode {Name = "LGW", Operational = true}
};
}
public static readonly DependencyProperty HasProblemProperty =
DependencyProperty.Register(
"HasProblem",
typeof(bool),
typeof(AirportCodeDataSource));
public bool HasProblem
{
get { return (bool)GetValue(HasProblemProperty); }
set { SetValue(HasProblemProperty, value); }
}
public ObservableCollection<AirportCode> View { get; set; }
}