Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何检查AttachedFlyout是否打开_C#_Xaml_Uwp_Uwp Xaml - Fatal编程技术网

C# 如何检查AttachedFlyout是否打开

C# 如何检查AttachedFlyout是否打开,c#,xaml,uwp,uwp-xaml,C#,Xaml,Uwp,Uwp Xaml,我所拥有的是: <Grid x:Name="MyGrid"> <FlyoutBase.AttachedFlyout> <MenuFlyout Placement="Bottom"> <MenuFlyoutItem Text="Item 1" /> <MenuFlyoutItem Text="Item 2" /> <MenuFlyoutI

我所拥有的是:

<Grid x:Name="MyGrid">
    <FlyoutBase.AttachedFlyout>
        <MenuFlyout Placement="Bottom">
            <MenuFlyoutItem Text="Item 1" />
            <MenuFlyoutItem Text="Item 2" />
            <MenuFlyoutItem Text="Item 3" />
        </MenuFlyout>
    </FlyoutBase.AttachedFlyout>
</Grid>

不幸的是,对于
菜单uflyout
,没有类似于
IsOpen
的属性。别问我为什么

这有点难看,但您可以实现如下检查:

bool isMenuOpened;
MenuFlyout.GetAttachedFlyout(MyGrid).Opened += (sender, e) => isMenuOpened = true;
MenuFlyout.GetAttachedFlyout(MyGrid).Closed += (sender, e) => isMenuOpened = false;
bool isMenuOpened;
MenuFlyout.GetAttachedFlyout(MyGrid).Opened += (sender, e) => isMenuOpened = true;
MenuFlyout.GetAttachedFlyout(MyGrid).Closed += (sender, e) => isMenuOpened = false;