在 UWP 应用中更改 Flyout 的高度和宽度 [英] Change height and width of Flyout in UWP app

查看:28
本文介绍了在 UWP 应用中更改 Flyout 的高度和宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 UWP 应用中使用 Flyout 元素:

I am using a Flyout element in my UWP app as:

<Flyout Placement="Full"/>

这会根据需要在应用程序中心打开浮出控件.但我无法更改弹出窗口的高度和宽度.如何才能做到这一点?

This opens the flyout in the centre of the app as desired. But I am unable to change the height and width of the flyout. How can this be done?

推荐答案

类似下面的代码应该可以满足您的需求.

Something like the below code should work for what you need.

private void Flyout_Opened(object sender, object e)
{         
    Flyout f = sender as Flyout;
    Style s = new Windows.UI.Xaml.Style { TargetType = typeof(FlyoutPresenter) };
    s.Setters.Add(new Setter(MinHeightProperty, "200"));        
    s.Setters.Add(new Setter(MinWidthProperty, "200"));
    f.FlyoutPresenterStyle = s;
}

这篇关于在 UWP 应用中更改 Flyout 的高度和宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆