Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#



Hi I'm a newbie in silverlight...Now im trying to implement a flyout stack panel with help from this Link.My requirement is that intially my stack panel should not be visible and when my mouse enter the button the stack panel should be visible and it should fly out which works perfectly.The issue im facing when it shrink it should shrink and should be invisible,with my code the shrink effect is not seen properly.Can we like halt the visibility for few seconds???I'm including the code...Any help will be greatly appreciated..
XML
<Grid x:Name="LayoutRoot">
       <StackPanel x:Name="spButtons" Orientation="Vertical" Visibility="Collapsed"
   removed="Black" Height="14" Width="500" RenderTransformOrigin="0.502,-0.263" Margin="-157.428,184.483,297.427,281.517" UseLayoutRounding="False" d:LayoutRounding="Auto">
           <StackPanel.RenderTransform>
               <CompositeTransform Rotation="-89.14" TranslateX="-31.313" TranslateY="29.255"/>
           </StackPanel.RenderTransform>
       </StackPanel>
       <Button Margin="436,109,101,333" x:Name="btTest" Height="40" Width="50" MouseEnter="btTest_MouseEnter" MouseLeave="btTest_MouseLeave" />
       <Grid.Resources>
           <Storyboard x:Name="Shrink">
               <DoubleAnimation Storyboard.TargetName="spButtons"
    Storyboard.TargetProperty="Height"
    From="40" To="14" Duration="00:00:20.0" />
           </Storyboard>
           <Storyboard x:Name="Grow">
               <DoubleAnimation Storyboard.TargetName="spButtons"
    Storyboard.TargetProperty="Height"
    From="14" To="40" Duration="00:00:00.5" />
           </Storyboard>
       </Grid.Resources>
   </Grid>

C#
private void btTest_MouseEnter(object sender, MouseEventArgs e)
        {
            spButtons.Visibility = Visibility.Visible;
            Grow.Begin();
        }

        private void btTest_MouseLeave(object sender, MouseEventArgs e)
        {
            Shrink.Begin();
            spButtons.Visibility = Visibility.Collapsed;
        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900