0
当用户将鼠标悬停在某些控件上时,我需要在Silverlight 4.0中实现弹出窗口。弹出窗口应该从控件中滑出。我可以显示一个弹出窗口。但不能给它一个滑动效果。请帮助我。在Silverlight中滑动弹出窗口
在此先感谢。
当用户将鼠标悬停在某些控件上时,我需要在Silverlight 4.0中实现弹出窗口。弹出窗口应该从控件中滑出。我可以显示一个弹出窗口。但不能给它一个滑动效果。请帮助我。在Silverlight中滑动弹出窗口
在此先感谢。
我一直在使用带阴影的矩形来滑动类型“弹出窗口”。如果您需要模式类型,您可以禁用背景。
这是使用纯xaml,但故事板可以从代码隐藏中调用。
参考交互
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Class="SomeProject"
我使用的导航页面,以便我对进出转换的幻灯片代码如下所示。
<navigation:Page.Resources>
<Storyboard x:Name="Storyboard_Enter">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="rectangle">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="520"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<Storyboard x:Name="Storyboard_GoBack">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateX)" Storyboard.TargetName="rectangle">
<SplineDoubleKeyFrame KeyTime="0" Value="520"/>
<SplineDoubleKeyFrame KeyTime="0:0:2" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</navigation:Page.Resources>
的LayoutRoot
<Grid x:Name="LayoutRoot">
<Button x:Name="btnEnter" Content="Enter" HorizontalAlignment="Left" Height="48" Margin="96,88,0,0" VerticalAlignment="Top" Width="144">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter" SourceName="btnEnter">
<ei:ControlStoryboardAction Storyboard="{StaticResource Storyboard_Enter}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<Rectangle x:Name="rectangle" Fill="#FF393939" Margin="-376,232,0,72" Stroke="Black" RadiusY="25" RadiusX="21" HorizontalAlignment="Left" Width="358" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<CompositeTransform/>
</Rectangle.RenderTransform>
<Rectangle.Effect>
<DropShadowEffect BlurRadius="15" Color="#FFBABABA"/>
</Rectangle.Effect>
</Rectangle>
<Button x:Name="btnGoBack" Content="Exit" Height="48" Margin="296,88,192,0" VerticalAlignment="Top">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseEnter" SourceName="btnGoBack">
<ei:ControlStoryboardAction Storyboard="{StaticResource Storyboard_GoBack}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
这是一个非常粗略的例子,但应该让你开始。
我们有一个“弹出”容器坐在主画布边缘的视图外。
创建故事板以将其滑入并滑回。
故事板可以使用基于xaml的触发器或代码隐藏进行调用。