如何设置在UWP中生成的menuFlyout中的menuFlyoutSubItem的高度?

huangapple go评论93阅读模式
英文:

How to set the height for menuFlyoutSubItem generated menuFlyout in uwp?

问题

如何设置UWP中MenuFlyoutSubItem的高度 -> MenuFlyout的高度?

示例图像如下,

如何设置在UWP中生成的menuFlyout中的menuFlyoutSubItem的高度?

英文:

How to set the height for the MenuFlyoutSubItem's -> MenuFlyout height in uwp?

Sample Image is attached below,

如何设置在UWP中生成的menuFlyout中的menuFlyoutSubItem的高度?

答案1

得分: 1

你可以查看MenuFlyout主题资源,在MenuFlyoutPresenter中只有MinHeight属性可用于修改高度,但这将应用于所有MenuFlyoutSubItem,无法为单个SubItem单独设置高度。

private void MenuFlyout_Opened(object sender, object e)
{
    MenuFlyout menuFlyout = sender as MenuFlyout;
    Style style = new Style { TargetType = typeof(MenuFlyoutPresenter) };
    style.Setters.Add(new Setter(MinHeightProperty, "500"));
    menuFlyout.MenuFlyoutPresenterStyle = style;
}
英文:

You can check MenuFlyout theme resources, there is only the property MinHeight in MenuFlyoutPresenter to modify the height, but this will apply to all MenuFlyoutSubItem, and the height cannot be set individually for one SubItem.

private void MenuFlyout_Opened(object sender, object e)
{
    MenuFlyout menuFlyout = sender as MenuFlyout;
    Style style = new Style { TargetType = typeof(MenuFlyoutPresenter) };
    style.Setters.Add(new Setter(MinHeightProperty, "500"));
    menuFlyout.MenuFlyoutPresenterStyle = style;
}

huangapple
  • 本文由 发表于 2023年7月4日 20:17:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76612535.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定