-
May 13th, 2020, 02:33 AM
#1
Event Trigger only for parent expander, not for all
I have a GroupBox which conatains an Expander and there is another expander inside the first one. So the first expander is a parent to the second one.
What I want to do is to put a blue border around the parent expander when parent expander is expanded and set it back to white, when it's collapsed. What I have works also, but the parent expander is not the only one which can do this. When I expand the child the event starts as well, which I don't want.
Can someone help me make the parent expander be the only one being able to start the event?
My code:
Code:
<GroupBox x:Name="ABC" Header="Something" Width="Auto" Margin="-800,35,-600,20" Grid.Column="1" BorderBrush="White" FontFamily ="Century Gothic" FontSize="16" >
<Expander x:Name="Kat_1" FontFamily="Century Gothic" FontSize="20" Header=" Funktion / Leitung" IsExpanded="False" Foreground="#FF19194D" Visibility="Visible" Margin="10,10,875,792" Height="900">
<Expander.Effect>
<DropShadowEffect BlurRadius="5" ShadowDepth="2" />
</Expander.Effect>
<Expander.BorderBrush>
<LinearGradientBrush>
<GradientStop />
<GradientStop />
</LinearGradientBrush>
</Expander.BorderBrush>
<Expander.Triggers>
<EventTrigger RoutedEvent="Expander.Expanded" SourceName="Kat_1">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard TargetName="Kat_1" >
<Storyboard TargetProperty="BorderBrush.GradientStops[0].Color" >
<ColorAnimation From="White"
To="#FF19194D"
Duration="0:0:1"
AutoReverse="False" />
</Storyboard>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard TargetName="Kat_1" >
<Storyboard TargetProperty="BorderBrush.GradientStops[1].Offset">
<DoubleAnimation From="0"
To="1"
Duration="0:0:1"
AutoReverse="False" />
</Storyboard>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
<EventTrigger RoutedEvent="Expander.Collapsed" SourceName="Kat_1">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard TargetName="Kat_1" >
<Storyboard TargetProperty="BorderBrush.GradientStops[0].Color">
<ColorAnimation From="#FF19194D"
To="White"
Duration="0:0:1"
AutoReverse="False" />
</Storyboard>
</Storyboard>
</BeginStoryboard>
<BeginStoryboard>
<Storyboard TargetName="Kat_1" >
<Storyboard TargetProperty="BorderBrush.GradientStops[1].Offset">
<DoubleAnimation From="1"
To="0"`enter code here`
Duration="0:0:1"
AutoReverse="False" />
</Storyboard>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Expander.Triggers>
<Expander x:Name="Kat_1_1" FontFamily="Century Gothic" FontSize="20" Header=" Allgemein" IsExpanded="False" Foreground="#FF19194D" Visibility="Visible" Margin="30,10,10,0" Width="570">
</Expander>
</Expander>
</GroupBox>
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|