【问题标题】:Place flyout at a point?在某个点放置弹出窗口?
【发布时间】:2017-07-28 03:16:48
【问题描述】:

在 uwp 应用程序中,是否可以显示与特定点相关的 Windows.UI.Xaml.Controls.Primitives.FlyoutBase 对象,而不是 FrameworkElement 对象?

换句话说,而不是

flyout.ShowAt(some frameworkElement);

我想要类似的东西

flyout.ShowAt(some frameworkElement, x, y).

我意识到我可以创建一个虚拟 FrameworkElement 并这样做,然后在删除浮出控件时删除虚拟。但这似乎有点重量级。

【问题讨论】:

  • 这肯定适用于 MenuFlyout,但似乎 FlyoutBase 缺少在特定点显示的方法。

标签: c# uwp flyout


【解决方案1】:

上面的 Romasz 评论有正确的答案。如果浮出控件实际上是 MenuFlyout,则将其强制转换为该类,然后调用。

Windows.Foundation.Point point = whatever;// your point here
menuFlyout.ShowAt(frameworkElement, point);

【讨论】:

    猜你喜欢
    • 2016-11-24
    • 2011-04-27
    • 1970-01-01
    • 1970-01-01
    • 2012-07-08
    • 2016-08-13
    • 1970-01-01
    • 1970-01-01
    • 2017-08-13
    相关资源
    最近更新 更多