我正在使用 wpf 弹出控件。
<Popup x:Name="tabHolder" IsOpen="False"
PopupAnimation="Slide" Placement="Bottom"
PlacementTarget="{Binding ElementName=mainWidgetWindow}">
<Grid Height="105" Width="315" />
</Popup>
这里我设置了弹出动画属性为滑动。但是当它打开时,它没有动画。我是否必须为弹出窗口添加任何其他配置才能使用动画选项幻灯片打开?
我使用的是 .net 框架 3.5 版。
最佳答案
来自MSDN
A Popup can only animate when the
AllowsTransparency
property is set totrue
. This requires the application that creates the Popup control to run with full trust. If thePlacementTarget
is animated, the Popup will not be animated.
XAML 应该看起来像
<DockPanel Width="500" Background="Aqua">
<Popup Placement="Center" PlacementRectangle="0,0,30,50"
IsOpen ="True" AllowsTransparency="True"
PopupAnimation="Fade">
<TextBlock Background="Purple">Popup Text</TextBlock>
</Popup>
</DockPanel>
您还可以阅读更多 here .
关于c# - WPF 弹出窗口 : open with animation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20069686/