I have a menu which has nested menu items within them which when hovered over the main menu start point opens the menu structure. However, we have recently moved the menu from the bottom of our Silverlight app to the top of the page and I cannot seem to find the way to change the opening direction when hovering over the starting menu point.
Currently, it opens above the starting menu point and I require the menu to open below it.
<StackPanel x:Name="ToolbarLogo" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Background="{StaticResource ToolbarBackgroundBrush}" Orientation="Horizontal">
<viblend:Menu Visibility="Visible" Canvas.ZIndex="99" Orientation="Horizontal" VerticalAlignment="Bottom" AnimationType="Bounds" x:Name="MenuLogo" Margin="25,0,0,0" Style="{StaticResource ThemeMenuStyle}" HorizontalAlignment="Left" Padding="5,0,5,0">
<viblend:MenuItem Width="129" DropDownWidth="125" FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Bottom" Style="{StaticResource ThemeMenuItemStyle}" Padding="10,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Image Source="/ReACTSL;component/Assets/Images/Icons/ReACTLogoPlus.png" Width="100" Height="30"/>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem Tag="ReACTHome" x:Name="mi_ReACTHomeM" Width="125" FontSize="11" Style="{StaticResource ThemeMenuItemStyle}" HorizontalAlignment="Center" Padding="2,5,5,5" ShortcutKey="B" ShortcutModifierKeys="Control" >
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Home" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource HomeIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
<viblend:MenuItem Width="125" FontSize="11" Name="SSRSReportsMenuItem" Style="{StaticResource ThemeMenuItemStyle}" HorizontalAlignment="Center" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="SSRS Reports" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource ReportIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
<viblend:MenuItem Width="125" FontSize="11" Name="CrystalReportsMenuItem" Style="{StaticResource ThemeMenuItemStyle}" HorizontalAlignment="Center" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Crystal Reports" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource ReportIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
</viblend:Menu>
The following style is applied to the menu and and menu items
<Style TargetType="viblend:Menu" x:Key="ThemeMenuStyle">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Padding" Value="3" />
<Setter Property="TabNavigation" Value="Local" />
<Setter Property="Orientation" Value="Horizontal"></Setter>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="HorizontalTemplate">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel x:Name="LayoutRoot" Orientation="Horizontal" VerticalAlignment="Bottom" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="VerticalTemplate">
<Setter.Value>
<ItemsPanelTemplate>
<StackPanel x:Name="LayoutRoot" Orientation="Vertical" VerticalAlignment="Top" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="viblend:Menu">
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="Transparent" x:Name="Background" Opacity="1">
<ItemsPresenter x:Name="ItemsHost" VerticalAlignment="Top">
</ItemsPresenter>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="viblend:MenuItem" x:Key="ThemeMenuItemStyle">
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Padding" Value="9,3,9,3" />
<Setter Property="TabNavigation" Value="Local" />
<Setter Property="RootNormalForeBrush" Value="{StaticResource MenuItemRootForegroundBrush}"/>
<Setter Property="RootHighlightForeBrush" Value="{StaticResource MenuItemRootHighlightForegroundBrush}"/>
<Setter Property="DisabledForeBrush" Value="{StaticResource MenuItemDisabledForegroundBrush}"/>
<Setter Property="NormalForeBrush" Value="{StaticResource MenuItemForegroundBrush}"/>
<Setter Property="HighlightForeBrush" Value="{StaticResource MenuItemHighlightForegroundBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="viblend:MenuItem">
<Grid VerticalAlignment="Top">
<vsm:VisualStateManager.VisualStateGroups>
<vsm:VisualStateGroup x:Name="PopupStates">
<vsm:VisualStateGroup.Transitions>
<vsm:VisualTransition GeneratedDuration="00:00:00.1" To="PopupOpened"/>
<vsm:VisualTransition GeneratedDuration="00:00:00.1" To="PopupClosed"/>
<vsm:VisualTransition GeneratedDuration="00:00:00.1" To="PopupCollapsed"/>
<vsm:VisualTransition GeneratedDuration="00:00:00.2" To="PopupExpanded"/>
</vsm:VisualStateGroup.Transitions>
<vsm:VisualState x:Name="PopupExpanded">
<Storyboard x:Name="ExpandingStoryboard">
<DoubleAnimation
Storyboard.TargetName="AnimationPresenter"
Storyboard.TargetProperty="Percentage"
To="1.0" Duration="0:0:0.2"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="PopupCollapsed">
<Storyboard x:Name="CollapsingStoryboard">
<DoubleAnimation
Storyboard.TargetName="AnimationPresenter"
Storyboard.TargetProperty="Percentage"
To="0.0" Duration="0:0:0.1" />
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="PopupOpened">
<Storyboard x:Name="OpeningStoryboard">
<DoubleAnimation
Storyboard.TargetName="PopupChild"
Storyboard.TargetProperty="Opacity"
To="1.0" Duration="0:0:0.1" />
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="PopupClosed">
<Storyboard x:Name="ClosingStoryboard">
<DoubleAnimation
Storyboard.TargetName="PopupChild"
Storyboard.TargetProperty="Opacity"
To="0.0" Duration="0:0:0.1" />
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="CommonStates">
<vsm:VisualStateGroup.Transitions>
<vsm:VisualTransition GeneratedDuration="00:00:00.2"/>
</vsm:VisualStateGroup.Transitions>
<vsm:VisualState x:Name="Normal" >
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="ImageMargin" Storyboard.TargetProperty="Opacity" To="1"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="0"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="InnerBackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="0"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="HeaderMouseOver">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="HeaderBackground" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="1"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="ImageMargin" Storyboard.TargetProperty="Opacity" To="0"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="InnerBackgroundGradientOver" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="SelectionStates">
<vsm:VisualStateGroup.Transitions>
<vsm:VisualTransition GeneratedDuration="00:00:00.2"/>
</vsm:VisualStateGroup.Transitions>
<vsm:VisualState x:Name="Unselected">
<Storyboard>
<DoubleAnimation Duration="5" Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To="0"/>
<DoubleAnimation Duration="5" Storyboard.TargetName="BackgroundGradientSelectedDisabled" Storyboard.TargetProperty="Opacity" To="0"/>
</Storyboard>
</vsm:VisualState>
<vsm:VisualState x:Name="Selected">
<Storyboard>
<DoubleAnimation Duration="5" Storyboard.TargetName="Background" Storyboard.TargetProperty="Opacity" To="1"/>
<DoubleAnimation Duration="5" Storyboard.TargetName="BackgroundGradientSelectedDisabled" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</vsm:VisualState>
</vsm:VisualStateGroup>
<vsm:VisualStateGroup x:Name="FocusStates">
<vsm:VisualState x:Name="Focused"/>
<vsm:VisualState x:Name="Unfocused"/>
</vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>
<Rectangle Stroke="{StaticResource MenuImageMarginStrokeBrush}" Fill="{StaticResource MenuImageMarginBrush}" x:Name="ImageMargin" Width="27" StrokeThickness="0" HorizontalAlignment="Left" RadiusX="1" RadiusY="1" Opacity="1"></Rectangle>
<Rectangle Fill="{StaticResource MenuHeaderItemBackgroundBrush}" x:Name="HeaderBackground" RadiusX="1" RadiusY="1" Stroke="{StaticResource MenuHeaderItemStrokeBrush}" Opacity="0"></Rectangle>
<Rectangle Fill="{StaticResource ToolbarHoverBackgroundBrush}" RadiusX="5" RadiusY="5" x:Name="InnerBackgroundGradientOver" Stroke="{StaticResource MenuHighlightStrokeBrush}" Opacity="0"></Rectangle>
<Rectangle Margin="1" Fill="{StaticResource ToolbarHoverBackgroundBrush}" x:Name="BackgroundGradientOver" RadiusX="5" RadiusY="5" Stroke="#FF09638E" Opacity="1"></Rectangle>
<Rectangle x:Name="BackgroundGradientSelectedDisabled" RadiusX="1" RadiusY="1" Opacity="0">
<Rectangle.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFEFEFEF" Offset="0.046"/>
<GradientStop Color="#FFEFEFEF" Offset="0.194"/>
<GradientStop Color="#FFEFEFEF" Offset="0.507"/>
<GradientStop Color="#FFEFEFEF" Offset="0.521"/>
<GradientStop Color="#FFEFEFEF" Offset="0.811"/>
<GradientStop Color="#FFEFEFEF" Offset="0.982"/>
</LinearGradientBrush>
</Rectangle.Fill>
<Rectangle.Stroke>
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
<GradientStop Color="#FFEFEFEF"/>
<GradientStop Color="#FFEFEFEF" Offset="1"/>
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<Rectangle Stroke="{StaticResource MenuSeparatorStroke}" Fill="{StaticResource MenuSeparatorBrush}" x:Name="SeparatorBackground" Margin="1,1,1,1" Height="1" StrokeThickness="0" RadiusX="1" RadiusY="1" Opacity="0"></Rectangle>
<Rectangle Stroke="{StaticResource MenuSelectedStrokeBrush}" Fill="{StaticResource MenuSelectedBrush}" x:Name="Background" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0"></Rectangle>
<!--<Path Visibility="Collapsed" Height="10" HorizontalAlignment="Left" Margin="10,1,0,1.5" x:Name="CheckIcon" Width="10.5" Opacity="0" Fill="{StaticResource MenuCheckIconBrush}" Stretch="Fill" Data="M102.03442,598.79645 L105.22962,597.78918 L106.78825,600.42358 C106.78825,600.42358 108.51028,595.74304 110.21724,593.60419 C112.00967,591.35822 114.89314,591.42316 114.89314,591.42316 C114.89314,591.42316 112.67844,593.42645 111.93174,594.44464 C110.7449,596.06293 107.15683,604.13837 107.15683,604.13837 z"/>-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<ContentControl
x:Name="contentPresenter"
FontFamily="Segoe UI, Microsoft Sans Serif, Verdana"
Grid.Column="0"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="Top"
Margin="{TemplateBinding Padding}"/>
<Path Margin="10,0,0,0" HorizontalAlignment="Right" x:Name="arrow" Fill="{StaticResource MenuArrowBrush}" VerticalAlignment="Center" RenderTransformOrigin="0,1.2" Stroke="{StaticResource MenuArrowBrush}" StrokeThickness="2" Data="M 1,1.5 L 4.5,5 L 8,1.5" Opacity="1">
<Path.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-90"/>
<TranslateTransform/>
</TransformGroup>
</Path.RenderTransform>
</Path>
</StackPanel>
<Popup x:Name="Popup" VerticalAlignment="Top">
<Border CornerRadius="5,5,5,5" x:Name="PopupChild" BorderThickness="0,0,0,0" Background="Transparent" Opacity="0">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0, 0.5" StartPoint="1,0.5">
<GradientStop Color="#FFB1C7D6" Offset="0"/>
<GradientStop Color="#FFB1C7D6" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
<Border CornerRadius="5,5,5,5" Height="{TemplateBinding DropDownHeight}" x:Name="PopupChild2" BorderThickness="1" BorderBrush="{StaticResource MainMenuBackgroundBrush}" Background="{StaticResource MainMenuBackgroundBrush}" Opacity="1">
<utilityControls:ScrollablePanel utilityControls:ScrollablePanel.VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}" x:Name="ScrollablePanel" HorizontalScrollBarVisibility="Disabled">
<ItemsPresenter Margin="1" x:Name="ItemsHost" VerticalAlignment="Top">
</ItemsPresenter>
</utilityControls:ScrollablePanel>
</Border>
</Border>
</Popup>
<!--<utilities:ExpandableContentControl x:Name="AnimationPresenter" VerticalAlignment="Top">
</utilities:ExpandableContentControl>-->
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
This is only a guess: Try set the VerticalAlignment of the menu root element to Top. It seems to me the menu is too big for the Stackpanel and will therefore be rendered beyond the bottom resp. top of the StackPanel (by design).
<viblend:Menu VerticalAlignment="Top" ...>
...
</viblend:Menu>
Just for information with anybody else who may be struggling with a similar problem with the VIBlend menu.
<Grid x:Name="LayoutRoot" Margin="0">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.RowDefinitions>
<RowDefinition x:Name="ToolbarContainer" Height="Auto"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<viblend:Menu x:Name="MenuLogo" Orientation="Horizontal" AnimationType="Bounds" Style="{StaticResource ThemeMenuStyle}" Height="40" Margin="25,0,0,0" HorizontalAlignment="Left" Padding="5,0,5,0" VerticalAlignment="Top">
<viblend:MenuItem Width="129" DropDownWidth="125" FontSize="11" Style="{StaticResource ThemeMenuItemStyle}" Padding="10,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Image Source="/ReACTSL;component/Assets/Images/Icons/ReACTLogoPlus.png" Width="100" Height="30"/>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem Tag="ReACTHome" x:Name="mi_ReACTHomeM" Width="125" FontSize="11" Style="{StaticResource ThemeMenuItemStyle}" Padding="2,5,5,5" ShortcutKey="B" ShortcutModifierKeys="Control" >
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Home" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource HomeIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
<viblend:MenuItem Width="125" FontSize="11" Name="SSRSReportsMenuItem" Style="{StaticResource ThemeMenuItemStyle}" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="SSRS Reports" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource ReportIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
<viblend:MenuItem Width="125" FontSize="11" Name="CrystalReportsMenuItem" Style="{StaticResource ThemeMenuItemStyle}" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Crystal Reports" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource ReportIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
<viblend:MenuItem Tag="Configuration" Width="125" FontSize="11" Style="{StaticResource ThemeMenuItemStyle}" DropDownWidth="120" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Configuration" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource ConfigIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem Style="{StaticResource ThemeMenuItemStyle}" Width="125" FontSize="11" DropDownWidth="220" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Case" Foreground="White" VerticalAlignment="Center"></TextBlock>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem x:Name="mi_Assessments" Text="Assessments" Tag="ListAssessment" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ActionStages" Text="Case Action Stages" Tag="ListActionStage" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_AgenciesContacts" Text="Case Agencies & Contacts" Tag="ListAgency" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_Companies" Text="Case Companies" Tag="ListCompany" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CostingTypes" Text="Case Costing Types" Tag="ListCostingType" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseCostingTypeCategories" Text="Case Costing Type Categories" Tag="ListCostingTypeCategories" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseDefinitions" Text="Case Definitions" Tag="ListCaseDefinitions" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseOutcomes" Text="Case Outcomes" Tag="ListCaseOutcome" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseStagePriorities" Text="Priority Levels" Tag="ListPriorityLevels" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseSources" Text="Case Sources" Tag="ListCaseSource" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseStatusValues" Text="Case Status Values" Tag="ListCaseTypeStatusValue" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseTypes" Text="Case Types" Tag="ListCaseType" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseWards" Text="Case Wards" Tag="ListCaseWards" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_NotActionedReasons" Text="Not Actioned Reasons" Tag="ListNoActionReason" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_OrderCategory" Text="Order Type Categories" Tag="ListOrderCategories" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CaseRechargeTypes" Text="Recharge Types" Tag="ListCaseReChargeTypes" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_SupportTypes" Text="Support Types" Tag="ListSupportType" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
</viblend:MenuItem>
<viblend:MenuItem Style="{StaticResource ThemeMenuItemStyle}" Width="125" FontSize="11" HorizontalAlignment="Center" DropDownWidth="200" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Individual" Foreground="White" VerticalAlignment="Center"></TextBlock>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem x:Name="mi_AgeRange" Text="Age Ranges" Tag="ListAgeRange" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_EthnicOrigin" Text="Ethnic Origins" Tag="ListEthnicOrigin" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_Landlords" Text="Landlords" Tag="ListLandLord" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_Religions" Text="Religions" Tag="ListReligion" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_SexOrientation" Text="Sexual Orientations" Tag="ListSexualOrientation" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_TenancyTypes" Text="Tenancy Types" Tag="ListTenancyType" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_TenureTypes" Text="Tenure Types" Tag="ListTenureType" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_IndTitles" Text="Titles" Tag="ListIndividualTitles" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
</viblend:MenuItem>
<viblend:MenuItem Style="{StaticResource ThemeMenuItemStyle}" Width="125" FontSize="11" HorizontalAlignment="Center" VerticalAlignment="Bottom" DropDownWidth="200" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Settings" Foreground="White" VerticalAlignment="Center"></TextBlock>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem x:Name="mi_ChangeUserPassword" Text="Change Password" Tag="/ChangeUserPassword/True" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CorrTemplates" Text="Document Templates" Tag="ListCorrespondenceTemplates" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_OutOfOffice" Text="Out Of Office" Tag="/OutOfOffice/0" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ReAllocateStaffOfficers" Text="Reallocate Staff Officers" Tag="ReAllocateStaffOfficers" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_StaffOfficers" Text="Staff Officers" Tag="/ListStaffOfficer/0" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
</viblend:MenuItem>
</viblend:MenuItem>
<viblend:MenuItem Width="125" x:Name="mi_Administration" FontSize="11" HorizontalAlignment="Center" DropDownWidth="200" Style="{StaticResource ThemeMenuItemStyle}" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="30"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Administration" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource AdminIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
<viblend:MenuItem x:Name="mi_AuditTrail" Text="Audit Trail" Tag="AuditTrail" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CloudAdmin" Text="Cloud Administration" Tag="CloudAdmin" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_CustomFields" Text="Custom Fields" Tag="CustomFields" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ConfigurableFields" Text="Configurable Fields" Tag="ConfigurableFields" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ExchangeAdmin" Text="Email / Exchange Settings" Tag="ExchangeAdmin" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_FindSettings" Text="Find Settings" Tag="FindSettings" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_Holidays" Text="Holidays" Tag="ListHolidays" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_Imports" Text="Import(s)" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5">
<viblend:MenuItem x:Name="mi_PendingNoteImports" Text="Pending Notes" Tag="PendingNoteImport" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_DamageReportImports" Text="Damage Reports" Tag="DamageReportImport" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_OperatorReportImports" Text="Operator Reports" Tag="OperatorReportImport" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_YouthReportImports" Text="Youth Reports" Tag="YouthReportImport" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
</viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ManageLoginsAndCaseLocks" Text="Manage Logins / Case Locks" Tag="ManageLoginsAndLocks" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_MandatoryFields" Text="Mandatory Fields" Tag="MandatoryFields" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_MappingExport" Text="Mapping Export Format" Tag="MappingExportFormat" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_PostCodeSearch" Text="Post Code Search" Tag="ListPostCodeSearch" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ReACTSettings" Text="ReACT Today Settings" Tag="ReACTTodaySettings" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_ReportConfig" Text="Report Access Configuration" Tag="ReportAccessConfigration" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_SatisfactionForms" Text="Satisfaction Form" Tag="ListFeedbackCategory" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_SysSettings" Text="System Administration" Tag="SystemAdmin" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_UserAccounts" Text="User Account" Tag="/UserAccount/0" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
<viblend:MenuItem x:Name="mi_UserGroups" Text="User Groups" Tag="UserGroups" Style="{StaticResource ThemeMenuItemStyle}" ImageSource="/ReACTSL;component/Assets/Images/Icons/circle1.png" Padding="5"></viblend:MenuItem>
</viblend:MenuItem>
<viblend:MenuItem Width="125" FontSize="11" Tag="LogOut" HorizontalAlignment="Center" DropDownWidth="110" Style="{StaticResource ThemeMenuItemStyle}" Padding="2,5,5,5">
<viblend:MenuItem.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="Logout" Foreground="White" VerticalAlignment="Center"></TextBlock>
<Image Source="{StaticResource LogOutIcon}" HorizontalAlignment="Left" Grid.Column="0" Width="25" Height="25" Margin="1"></Image>
</Grid>
</DataTemplate>
</viblend:MenuItem.HeaderTemplate>
</viblend:MenuItem>
</viblend:MenuItem>
</viblend:Menu>
<StackPanel x:Name="ToolbarAccessibility" Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center" Orientation="Horizontal">
...
</StackPanel>
<viblend:Menu x:Name="MenuIcons" Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Top" AnimationType="Bounds" Margin="0,0,25,0" Style="{StaticResource ThemeMenuStyle}" HorizontalAlignment="Right" Padding="5,0,5,0">
...
</viblend:Menu>
<ScrollViewer x:Name="scrollViewer" Margin="0" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" HorizontalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" VerticalScrollBarVisibility="Auto" VerticalAlignment="Stretch" Background="{StaticResource PageBackgroundBrush}" BorderThickness="0">
<navigation:Frame HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Name="ContentFrame" Navigating="ContentFrame_Navigating">
<navigation:Frame.UriMapper>
<urimapper:UriMapper>
<urimapper:UriMapping Uri="Login" MappedUri="/Login.xaml" />
</urimapper:UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
</ScrollViewer>
</Grid>
</Grid>
The problem was with the layout of the menus container. Having re-written the page which contains the menu along with the applications content, with help of the sample code from VIBlend, it works as expected.
I have a problem with an animantion of an UserControl.
The animation runs only once.
If I have multiple instances of my UserControl in another window, the animation is called for every Instance of the UserControl.
<UserControl x:Class="My_UserControl"
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"
mc:Ignorable="d" Margin="10,10">
<UserControl.Resources>
<Storyboard x:Key="CartTicket_Whip">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[1].(SkewTransform.AngleY)" Storyboard.TargetName="UserControlGrid">
<SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="-2"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="UserControlGrid">
<DiscreteBooleanKeyFrame KeyTime="0:0:0.1" Value="True"/>
<DiscreteBooleanKeyFrame KeyTime="0:0:0.2" Value="False"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="Button.Click" SourceName="DecrementButton">
<BeginStoryboard Storyboard="{StaticResource CartTicket_Whip}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid x:Name="UserControlGrid" Height="60">
<Grid.LayoutTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.LayoutTransform>
<Grid.Effect>
<DropShadowEffect ShadowDepth="5" Color="Silver"></DropShadowEffect>
</Grid.Effect>
<DockPanel Background="White">
<Button Name="DecrementButton" DockPanel.Dock="Left" Content="-" FontSize="40" Width="60">
</Button>
<TextBlock x:Name="TicketCount" DockPanel.Dock="Left" Text="2 x" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20" FontWeight="Bold" Margin="10">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="4" Color="Silver"></DropShadowEffect>
</TextBlock.Effect>
</TextBlock>
<StackPanel DockPanel.Dock="Left" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">
<TextBlock x:Name="TicketName" Text="Ticket type 01" HorizontalAlignment="Center"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<TextBlock x:Name="PriceTxt" Grid.Column="2" Text="100" HorizontalAlignment="Center"/>
<TextBlock x:Name="PriceTxt_currency" Grid.Column="2" Text=" EUR" HorizontalAlignment="Center"/>
</StackPanel>
</StackPanel>
</DockPanel>
</Grid>
</UserControl>
You can set the FillBehavior property of your Storyboard to Stop in this way:
<UserControl.Resources>
<Storyboard x:Key="CartTicket_Whip" FillBehavior="Stop">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[1].(SkewTransform.AngleY)" Storyboard.TargetName="UserControlGrid">
<SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="-2"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsHitTestVisible)" Storyboard.TargetName="UserControlGrid">
<DiscreteBooleanKeyFrame KeyTime="0:0:0.1" Value="True"/>
<DiscreteBooleanKeyFrame KeyTime="0:0:0.2" Value="False"/>
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
I hope it helps.
Ok, I got it... sorry it is a dump coincidance! Because I changed the skew of the Grid element, to have a bob up and down effect, the hole usercontrol had this effect.
Now in my window I put five of this UserControls in a Grid, under each other...
So there was the effect, that on every click it seems that evrey UserControl started the animation...
So here the new code, where I make the storyboard for a child element (the dockPanel):
<UserControl x:Class="MyUserControl"
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"
mc:Ignorable="d" Margin="10,10">
<UserControl.Resources>
<Storyboard x:Key="CartTicket_Whip">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[1].(SkewTransform.AngleY)" Storyboard.TargetName="UserControlDockPanel">
<SplineDoubleKeyFrame KeyTime="0:0:0.1" Value="-1.5"/>
<SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</UserControl.Resources>
<UserControl.Triggers>
<EventTrigger RoutedEvent="Button.Click" SourceName="DecrementButton">
<BeginStoryboard Storyboard="{StaticResource CartTicket_Whip}"/>
</EventTrigger>
</UserControl.Triggers>
<Grid x:Name="UserControlGrid" Height="60">
<Grid.LayoutTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Grid.LayoutTransform>
<Grid.Effect>
<DropShadowEffect ShadowDepth="5" Color="Silver"></DropShadowEffect>
</Grid.Effect>
<DockPanel x:Name="UserControlDockPanel" Background="White" RenderTransformOrigin="0.5,0.5">
<DockPanel.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</DockPanel.RenderTransform>
<Button Name="DecrementButton" DockPanel.Dock="Left" Content="-" FontSize="40" Width="60">
</Button>
<TextBlock x:Name="TicketCount" DockPanel.Dock="Left" Text="2 x" VerticalAlignment="Center" HorizontalAlignment="Center"
FontSize="20" FontWeight="Bold" Margin="10">
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="4" Color="Silver"></DropShadowEffect>
</TextBlock.Effect>
</TextBlock>
<StackPanel DockPanel.Dock="Left" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5">
<TextBlock x:Name="TicketName" Text="Ticket type 01" HorizontalAlignment="Center"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,10,0,0">
<TextBlock x:Name="PriceTxt" Grid.Column="2" Text="100" HorizontalAlignment="Center"/>
<TextBlock x:Name="PriceTxt_currency" Grid.Column="2" Text=" EUR" HorizontalAlignment="Center"/>
</StackPanel>
</StackPanel>
</DockPanel>
</Grid>
</UserControl>
Earlier I asked about a fade-in,scroll down animation for items control insertion ( Animate Insertions to ItemsControl ). I got the fade-in working but I'm still perplexed about the items control insertion animation. Below is somethings that "sort of" works.
<Grid>
<ScrollViewer>
<ItemsControl Name="TimelineItems"
ItemsSource="{Binding Timeline}"
Style="{StaticResource TimelineStyle}"
ItemContainerStyle="{StaticResource TweetItemStyle}">
<ItemsControl.RenderTransform>
<TransformGroup>
<TranslateTransform />
</TransformGroup>
</ItemsControl.RenderTransform>
<ItemsControl.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.SizeChanged">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="TimelineItems"
Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.Y)">
<EasingDoubleKeyFrame KeyTime="0"
Value="-50" />
<EasingDoubleKeyFrame KeyTime="0:0:0.5"
Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ItemsControl.Triggers>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="MyGrid"
Background="{Binding TweetType, Converter={StaticResource tweetTypeConverter}}"
VerticalAlignment="Top"
HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Style="{StaticResource TweetImageColumnStyle}" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Rectangle Grid.Column="0"
Style="{StaticResource TweetImageStyle}">
<Rectangle.Fill>
<ImageBrush ImageSource="{Binding ProfileImageUrl}" />
</Rectangle.Fill>
</Rectangle>
<StackPanel Grid.Column="1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Style="{StaticResource TweetNameStyle}"
Text="{Binding Name}" />
<TextBlock Grid.Column="1"
Style="{StaticResource TweetTimeStyle}"
Text="{Binding TimeAgo}" />
</Grid>
<Controls:TextBlockMarkup Grid.Row="1"
Grid.Column="1"
Markup="{Binding MarkupText}"
Style="{StaticResource TweetStyle}" />
</StackPanel>
<Separator Grid.Row="2"
Grid.ColumnSpan="2"
Style="{StaticResource TweetSeparatorTop}" />
<Separator Grid.Row="3"
Grid.ColumnSpan="2"
Style="{StaticResource TweetSeparatorBottom}" />
</Grid>
<DataTemplate.Resources>
<Storyboard x:Key="ItemAnimation"
AutoReverse="False">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="MyGrid"
Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0"
Value="0" />
<EasingDoubleKeyFrame KeyTime="0:0:0.8"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<DataTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
<BeginStoryboard Storyboard="{StaticResource ItemAnimation}" />
</EventTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
I say "sort of" because the list is offset by a negative offset and then animated into position. The "animation to position" looks great, but the "jump" to a negative offset spoils the affect.
In CSS, I would simply animate the height of the inserted item but I haven't puzzled out how to do this in WPF.
Thoughts?
So, I don't know all details, but I think usual way (I'm noob, lol) are:
Add FluidMove behavior to your visual collection
Insert new object with lower width and height, e.g. 1x1
Animate it to actual size via storyboard or manually DoubleAnimation
For some reason when I set two expanders beside one another, the first expander seems to be behind the second one and wont expand out the expander set beside it? Is there a way I can fix this in the code below?
<Grid>
<StackPanel Orientation="Horizontal" Margin="0,0,195,0">
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Expander.Expanded" SourceName="expander">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="1.2" Duration="0:0:0.35" Storyboard.TargetName="listBox" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>
<Expander x:Name="expander" Expanded="expander_Expanded" ExpandDirection="Right" Width="29">
<ListBox x:Name="listBox">
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBox.LayoutTransform>
<ScaleTransform ScaleX="0" ScaleY="1"/>
</ListBox.LayoutTransform>
</ListBox>
</Expander>
<StackPanel Orientation="Horizontal" Margin="0,0,342,0" Width="318">
<StackPanel.Triggers>
<EventTrigger RoutedEvent="Expander.Expanded" SourceName="expander1">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation From="0" To="1.2" Duration="0:0:0.35" Storyboard.TargetName="listBox1" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(ScaleTransform.ScaleX)"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</StackPanel.Triggers>
<Expander ExpandDirection="Right" Name="expander1" Width="29">
<ListBox Name="listBox1">
<ListBox.LayoutTransform>
<ScaleTransform ScaleX="0" ScaleY="1" />
</ListBox.LayoutTransform>
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
<ListBoxItem Content="ListBoxItem" VerticalAlignment="Top" />
</ListBox>
</Expander>
</StackPanel>
</StackPanel>
</Grid>
Remove Width="29" in
<Expander x:Name="expander"
Expanded="expander_Expanded"
ExpandDirection="Right"
Width="29">
and all will be okay.
in the following example, I don't understand how I could make my "Live Updates" groupbox appear/disappear when the upper checkbox is checked/unchecked. I am looking for a fast fade in/fade out effect in XAML but I am a little lost..
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="WpfControlLibrary1.MainControl"
x:Name="MultiVol" MinHeight="520.12" MinWidth="213">
<Grid HorizontalAlignment="Stretch">
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0.966"/>
<GradientStop Color="#FFD7D4FF"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel x:Name="LayoutRoot" HorizontalAlignment="Stretch" Grid.Row="0">
<GroupBox Margin="8,0" BorderBrush="#FF88B1D8" HorizontalAlignment="Stretch" Height="99">
<GroupBox.Header>
<WrapPanel>
<Label Content="General" Background="#00000000" Foreground="#FF0033FF" FontWeight="Bold" FontFamily="/WpfControlLibrary1;component/Fonts/#Tahoma" />
</WrapPanel>
</GroupBox.Header>
<UniformGrid Columns="2">
<Label Content="RICs" />
<TextBox AcceptsReturn="False" AcceptsTab="True" AllowDrop="True" IsTabStop="True" />
<Label Content="Preference" />
<UniformGrid VerticalAlignment="Center" Columns="2" Rows="1">
<RadioButton GroupName="preference" Content="Exotic" IsChecked="False" />
<RadioButton GroupName="preference" Content="Flow" IsChecked="True" />
</UniformGrid>
<Label Content="Live updates" />
<CheckBox IsChecked="True" VerticalAlignment="Center"/>
</UniformGrid>
</GroupBox>
</StackPanel>
<DockPanel Grid.Row="1" HorizontalAlignment="Stretch">
<GroupBox Margin="8,0" BorderBrush="#FF88B1D8" HorizontalAlignment="Stretch">
<GroupBox.Header>
<WrapPanel>
<Label Content="Live updates" Background="#00000000" Foreground="#FF0033FF" FontWeight="Bold" FontFamily="/WpfControlLibrary1;component/Fonts/#Tahoma" />
</WrapPanel>
</GroupBox.Header>
<ListView MinHeight="100" Background="{x:Null}">
<ListView.View>
<GridView AllowsColumnReorder="False">
<GridViewColumn Header="RIC" />
<GridViewColumn Header="Last tick" />
</GridView>
</ListView.View>
</ListView>
</GroupBox>
</DockPanel>
</Grid>
</UserControl>
UPDATE : I get the fade in now, and I tried to add the fade out by adding a Trigger tag :
<DockPanel.Style>
<Style TargetType="{x:Type DockPanel}">
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:0.5" From="0.0" To="1.0" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
<Trigger Property="Visibility" Value="Hidden">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:0.5" From="1.0" To="0.0" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</DockPanel.Style>
Two steps.
First Visibility:
Create a BooleanToVisibilityConverter in Resources
<UserControl.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>
Give your CheckBox a name
<CheckBox x:Name="LiveUpdateCheckBox" IsChecked="True" VerticalAlignment="Center" />
Bind the DockPanel.Visibility property per ElementName with BooleanToVisibilityConverter
<DockPanel Grid.Row="1" HorizontalAlignment="Stretch"
Visibility="{Binding ElementName=LiveUpdateCheckBox, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}">
Second Animation:
Create a DockPanel.Style for your LiveUpdates DockPanel
<DockPanel.Style>
<Style TargetType="{x:Type DockPanel}">
<Style.Triggers>
<Trigger Property="Visibility" Value="Visible">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="00:00:01" From="0.0" To="1.0" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
</Style.Triggers>
</Style>
</DockPanel.Style>