Getting the event one time
Last post 05-11-2008 1:26 PM by sladapter. 4 replies.
Sort Posts:
05-11-2008 4:50 AM
Getting the event one time

I have a popup in my Silverlight application with a close button. If i click the close button, then a DoubleAnimation is played and after it's played an event is raise that makes the popup Collapsed. If i show the pop again en pres the close button then event won't be raise again? Does anywone knows how to solved this?

 thx

Walter

Walter79

Joined on 05-08-2008
Maastricht
Posts 3
05-11-2008 5:07 AM
Re: Getting the event one time

 I can't think of anything that will prevent an event from firing for the second time. Can you show a snippet of your XAML and codebehind code to help us diagnose the problem?

Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider

y_makram

Joined on 06-07-2007
Cairo, Egypt
Posts 1,123
05-11-2008 5:17 AM
Re: Getting the event one time

Her it is, hope that you can help me 

<UserControl x:Class="Extranet.Silverlight.ContentControl" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
Width="400" Height="400">

<Canvas x:Name="LayoutRoot">
<Canvas.Resources>

<Storyboard x:Name="OpenContent">

<Storyboard>

<DoubleAnimation Storyboard.TargetName="recContent"

Storyboard.TargetProperty="Height" From="0" To="400" Duration="0:0:1" />

<DoubleAnimation Storyboard.TargetName="recContent"

Storyboard.TargetProperty="Width" From="0" To="400" Duration="0:0:1" />

<DoubleAnimation Storyboard.TargetName="cpContent" Storyboard.TargetProperty="Opacity" From="0" To="1" BeginTime="0:0:1" Duration="0:0:2" />

<DoubleAnimation Storyboard.TargetName="btnClose" Storyboard.TargetProperty="Opacity" From="0" To="1" BeginTime="0:0:1" Duration="0:0:2" />

</Storyboard>

</Storyboard>

<Storyboard x:Name="CloseContent">

<DoubleAnimation Storyboard.TargetName="recContent" Completed="DoubleAnimation_Completed" Storyboard.TargetProperty="Height" From="400" To="0" BeginTime="0:0:2" Duration="0:0:1" />

<DoubleAnimation Storyboard.TargetName="recContent"

Storyboard.TargetProperty="Width" From="400" To="0" BeginTime="0:0:2" Duration="0:0:1" />

<DoubleAnimation Storyboard.TargetName="cpContent" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:2" />

<DoubleAnimation Storyboard.TargetName="btnClose" Storyboard.TargetProperty="Opacity" From="1" To="0" Duration="0:0:2" />

</Storyboard>

</Canvas.Resources>

<Rectangle x:Name="recContent" Stroke="#FF000000" StrokeThickness="3" Width="400" Height="400" Fill="#E0E0E1" RadiusX="10" RadiusY="10" />

 

<ContentPresenter x:Name="cpContent" Opacity="0" Content="Wie dit lees is gek :D" Canvas.Left="10" Canvas.Top="15" Height="380" Width="385">

 

</ContentPresenter>

<Button x:Name="btnClose" Loaded="btnClose_Loaded" Click="btnClose_Click" Style="{StaticResource btnClose}" Canvas.Left="375" Canvas.Top="5" />

</Canvas>

</UserControl>

Walter79

Joined on 05-08-2008
Maastricht
Posts 3
05-11-2008 5:41 AM
Re: Getting the event one time

The code looks fine to me, I will try to use your code in a sample application and check if it is working later today. 

Thanks
Yasser Makram
My Blog: http://www.silverlightrecipes.com
Sr. Architect
Santeon Inc. Microsoft Silverlight Partner, Solution Provider

y_makram

Joined on 06-07-2007
Cairo, Egypt
Posts 1,123
05-11-2008 1:26 PM
Re: Getting the event one time

 what's the code behind for btnClose_Loaded, btnClose_Click and DoubleAnimation_Completed?

Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

sladapter

Joined on 03-05-2008
Indiana, US
Posts 404