473,322 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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.Layou tTransform).
(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.Layou tTransform).
(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>

May 15 '07 #1
0 974

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sway | last post by:
Hi All, Currently we have two databases both running on the same Install and Machine under MSSQL, one of these database's has two triggers that fire to update some tables on the other database,...
3
by: Ericson Smith | last post by:
Hi, Is there any way to prevent a trigger from firing during a COPY operation? We have a case where we dump the records from a table, truncate it, and copy the records back in. However, there...
2
by: Jack | last post by:
We are have a question about the no cascade option on before triggers. The description stays that no other triggers will be fired by the changes of a before trigger. One of our developers is...
3
by: Mo | last post by:
Hi, I using server side customvalidator in a FormVIew insert form. It triggers and regardless of the fact if args.IsValid is true or false the data get inserted. am I missing something? ...
10
by: Wylbur via DotNetMonster.com | last post by:
Hello to all of you geniuses, I'm having a problem trying to get an Init handler to fire for a Placeholder control at the initialization phase. I’ve posted this problem to 3 other ASP.NET...
2
by: cefrancke | last post by:
I have a datagrid on a windows form with a bindingnavigator. The tableadapter, bindingsource and dataset are there also. I can browse and edit data normally. I had added the "click" event...
4
by: --CELKO-- | last post by:
I need to convert a bunch of DB2 triggers to Oracle. Is there any kind of tools for this?
3
by: | last post by:
Hi - I can update a second field based on update of the the first field of the same table. It works fine in the Enterprise Manager (EM), but I can't seem to make the trigger fire when I alter the...
0
by: petwir | last post by:
We've got a cascading delete being used in DB2. I've built new triggers under the parent/child tables in this cascading delete relationship. So when they delete the parent, and the cascade...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.