我在我的 uwp 应用程序中使用弹出控件。我想在单击按钮时显示弹出窗口,而该按钮位于另一个弹出窗口中。 我想要图像中这样的 GUI。
谁能帮帮我?
最佳答案
A single object element that declares the content. This must be an object that has UIElement in its hierarchy (plain strings don't work). This can be a container, such as a Panel derived class, so that multiple content items within the Flyout can be arranged in layout.
有关详细信息,请参阅 Flyout class .
因此我们可以向 Flyout 的内容添加另一个 Button。
我们也可以使用 FlyoutPlacementMode
枚举设置为 FlyoutBase.Placement
将弹出按钮的位置设置在目标元素上方。
例如:
<Button Name="MyButton" VerticalAlignment="Center" HorizontalAlignment="Center"
Content="Open flyout">
<Button.Flyout>
<Flyout Placement="Right">
<Grid Width="300" Height="300">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Grid.Row="0" Content="Open second flyout">
<Button.Flyout>
<Flyout Placement="Left">
<Grid Width="300" Height="300">
<TextBlock TextWrapping="Wrap" Text="This is some text in a flyout." />
</Grid>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</Flyout>
</Button.Flyout>
如果你想显示项目菜单,请尝试使用MenuFlyout
控制。有关更多信息,包括 XAML 和代码示例,请参阅快速入门:Adding a MenuFlyout .
关于c# - 如何在按钮上单击弹出窗口,该按钮位于 uwp 中另一个弹出窗口中的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40932136/