gpt4 book ai didi

xaml - AppBarButton.Flyout 定位错误

转载 作者:行者123 更新时间:2023-12-04 18:07:34 25 4
gpt4 key购买 nike

在我的 Windows Phone 8.1 中有以下 CommandBar(我使用的是通用模板):

    <Page.BottomAppBar>
<CommandBar>
<AppBarButton Label="add task" Click="GoToAddTask">
<AppBarButton.Icon>
<SymbolIcon Symbol="Add" />
</AppBarButton.Icon>
</AppBarButton>
<AppBarButton Label="sort by">
<AppBarButton.Icon>
<SymbolIcon Symbol="Sort" />
</AppBarButton.Icon>
<AppBarButton.Flyout>
<MenuFlyout>
<MenuFlyoutItem Command="{Binding SortByDate}" Text="Date" />
<MenuFlyoutItem Text="Priority" Command="{Binding SortByPriority}" />
<MenuFlyoutItem Text="Name" Command="{Binding SortByName}" />
</MenuFlyout>
</AppBarButton.Flyout>
</AppBarButton>
<AppBarButton Label="pin project" Command="{Binding PinProject}">
<AppBarButton.Icon>
<SymbolIcon Symbol="Pin" />
</AppBarButton.Icon>
</AppBarButton>
</CommandBar>
</Page.BottomAppBar>

问题是当用户点击 AppBarButton “排序”,Flyout 的底部边缘似乎粘在 AppBar 本身后面的屏幕底部。这是一个屏幕截图:

Flyout positioning

我检查了等效的 Windows 8.1 并且它工作正常(如图所示 here )。

我假设 Flyout 将显示在 AppBar 本身上方。

最佳答案

我相信这是一个已知问题。不是将 MenuFlyout 放在内联,而是在单击事件上创建它:

private void AppBarButton_Click(object sender, RoutedEventArgs e)
{
MenuFlyout mf = (MenuFlyout)this.Resources["MyFlyout"];

mf.Placement = FlyoutPlacementMode.Bottom;
mf.ShowAt(this.root);
}

看看这是否有效。

关于xaml - AppBarButton.Flyout 定位错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23326717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com