I am trying to use the Outlook Bar as an area to notify users about specific information. If a condition is met I would like to flash the main area of the Notification bar red to notify the user that they need to do something. I have been able to do this for individual group boxes within the outlook bar but I want to do this for the main area where it says Navigation Pane.
Here is the code I am trying to use. The target name (Storyboard.TargetName="MyNotificationBarName") is currently pointing to the entire Outlook bar which is incorrect but I’m not sure what the Target is actually called.
<Storyboard x:Name="Blink" x:Key="alertUser" AutoReverse="True">
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background"
Duration="0:0:1" RepeatBehavior="Forever"
Storyboard.TargetName="MyNotificationBarName">
<ObjectAnimationUsingKeyFrames.KeyFrames>
<DiscreteObjectKeyFrame KeyTime="0:0:0.35">
<DiscreteObjectKeyFrame.Value>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#ff8b80" Offset="0.0" />
<GradientStop Color="#e52115" Offset="0.5" />
<GradientStop Color="#ff5736" Offset="1.0" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames.KeyFrames>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
And then in my code behind I call this
Storyboard alertUser = (Storyboard)FindResource("alertUser");
alertUser.Begin();
Thanks ...
Hi mbhyrdo,
Do you have any further questions on this issue?
When using resource dictionaries you have to define your resources a bit differently. Your resources need to be inside their own resource dictionary and then they all get merged together. So if we were to use your resources as an example, they should end up looking like this:
<Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/xamOutlookBar-NavigationPaneWindow;component/XamOutlookBarStyles.xaml"/> <ResourceDictionary> <local:VisibilityConverter x:Key="VisibilityConverter"/> <DataTemplate x:Key="CheckBoxLegendItem"> <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Series.Visibility, Mode=TwoWay, Converter={StaticResource VisibilityConverter}}"/> <ContentPresenter Content="{Binding}" ContentTemplate="{Binding Series.LegendItemBadgeTemplate}" /> <ContentPresenter Content="{Binding Series.Title, TargetNullValue=Series Title}"/> </StackPanel> </DataTemplate> </ResourceDictionary> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources>
Hi Rob,
Yes I am using the resource dictionary from your sample. Here is an example of other resources I’m trying to include which is causing the template to not be used:
<Window.Resources>
<local:VisibilityConverter x:Key="VisibilityConverter"/>
<DataTemplate x:Key="CheckBoxLegendItem">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Series.Visibility, Mode=TwoWay, Converter={StaticResource VisibilityConverter}}"/>
<ContentPresenter Content="{Binding}" ContentTemplate="{Binding Series.LegendItemBadgeTemplate}" />
<ContentPresenter Content="{Binding Series.Title, TargetNullValue=Series Title}"/>
</StackPanel>
</DataTemplate>
<ResourceDictionary x:Key="Notification">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/xamOutlookBar-NavigationPaneWindow;component/XamOutlookBarStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
As soon as I include the DataTemplate my application no longer uses the template
Thanks
Hi mbhydro,
Are you using the resource dictionary from my sample with your modifications? Can you give me an example of what you're trying to include in the Window.Resources that is causing the template to not be used?
This is exactly what I’m trying to do. Thank you for the two solutions. I am trying to use the solution you sent in the sample code since I want to change the content in the “Navigation Pane” meaning I’ll have to retemplate it anyways. I was able to do what I wanted only if I have one Resource in my Window.Resources. As soon as I add more Resources it no longer uses the file as it’s template. How can I resolve this?