![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Triggers Firing for Child Objects I am trying to make an animated Expander, that slides open and closed. It works fine, however when in put another Expander inside it, the triggers/routed events seem to get a little confused. When the child Expander is closed, it runs the CollapseMe Storyboard on the parent (even if the child doesn't have the Animated Template). Of course I don't want this to happen, because it's just weird. Can anyone help me please ![]() Cheers <Window x:Class="WpfTest.Window4" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="WpfTest" Height="343" Width="407" > <Window.Resources> <ControlTemplate x:Key="AnimatedExpander" TargetType="Expander"> <ControlTemplate.Resources> <Storyboard x:Key="ExpandMe"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.150" Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform). (TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <LinearDoubleKeyFrame KeyTime="00:00:00.150" Value="1"/> <DiscreteDoubleKeyFrame KeyTime="00:00:00.150" Value="1"/> </DoubleAnimationUsingKeyFrames> </Storyboard> <Storyboard x:Key="CollapseMe"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.150" Storyboard.TargetName="ContentBorder" Storyboard.TargetProperty="(FrameworkElement.LayoutTransform). (TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <LinearDoubleKeyFrame KeyTime="00:00:00.150" Value="0"/> <DiscreteDoubleKeyFrame KeyTime="00:00:00.150" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </ControlTemplate.Resources> <StackPanel> <ToggleButton Name="Header" IsChecked="{Binding Path=IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Padding="0"> <ContentPresenter Margin="4" ContentSource="Header" RecognizesAccessKey="True" /> </ToggleButton> <Border Name="ContentBorder" BorderBrush="LightGray" BorderThickness="1" Height="Auto"> <Border.LayoutTransform> <TransformGroup> <ScaleTransform ScaleX="1" ScaleY="1"/> <SkewTransform AngleX="0" AngleY="0"/> <RotateTransform Angle="0"/> <TranslateTransform X="0" Y="0"/> </TransformGroup> </Border.LayoutTransform> <ContentPresenter Margin="10"/> </Border> </StackPanel> <ControlTemplate.Triggers> <EventTrigger RoutedEvent="Expander.Expanded"> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource ExpandMe}"/> </EventTrigger.Actions> </EventTrigger> <EventTrigger RoutedEvent="Expander.Collapsed"> <EventTrigger.Actions> <BeginStoryboard Storyboard="{StaticResource CollapseMe}"/ > </EventTrigger.Actions> </EventTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Window.Resources> <Grid> <Expander Margin="30,36,45,44" Header="EXPANDER ONE" IsExpanded="True" Template="{StaticResource AnimatedExpander}"> <Expander Height="120" Padding="4" Background="Gainsboro" Header="CHILE EXPANDER" Width="160" IsExpanded="False"> <Button></Button> </Expander> </Expander> </Grid> </Window> |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Enumeration of NTFS Permissions including child objects.... | VB Script | |||
| DataGridView firing way to many SelectionChangedEvents! Please Help | .NET General | |||
| Linkbutton firing every other time issue | .NET General | |||
| firing noise in wmp11 | Vista General | |||