目前,如果您使用可见性绑定,导航视图在 Android 和 Wasm 中无法正确呈现。
据我所知,NavigationView 处于不稳定状态,但也许有人知道解决此问题的方法,例如强制使用当前绑定/可见性值重新计算 UI。
使用代码示例更新:
<NavigationView ItemInvoked="NavigationView_ItemInvoked" PaneDisplayMode="LeftMinimal" PaneOpened="NavigationView_PaneOpened" IsSettingsVisible="False" IsBackEnabled="False" IsBackButtonVisible="Collapsed">
<NavigationView.MenuItems>
<NavigationViewItem x:Uid="ButtonNew" Tag="createnew" Content="CREATENEW" />
<NavigationViewItem x:Uid="ButtonNewDrillZ2" Tag="createnewdrillz2" Content="DRILLZ2" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewDrillZ3" Tag="createnewdrillz3" Content="DRILLZ3" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewDrillStepZ2" Tag="createnewdrillstepz2" Content="DRILLSTEPZ2" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewCutterZ2" Tag="createnewcutterz2" Content="CUTTERZ2" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewCutterZ3R" Tag="createnewcutterz3r" Content="CUTTERZ3R" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewCutterZ4B" Tag="createnewcutterz4b" Content="CUTTERZ4B" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonNewCutterFormZ3" Tag="createnewcutterformz3" Content="CUTTERFORMZ3" Visibility="{Binding IsChooseNew, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItemSeparator Visibility="{Binding CanOpenShared, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonOpenShared" Tag="openshared" Content="OPENSHARED" Visibility="{Binding CanOpenShared, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItemSeparator Visibility="{Binding IsEditingTool, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonEdit" Tag="edit" Content="EDIT" Visibility="{Binding IsEditingTool, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonView2D" Tag="view2d" Content="VIEW2D" Visibility="{Binding IsEditingTool, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonView3D" Tag="view3d" Content="VIEW3D" Visibility="{Binding IsEditingTool, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItem x:Uid="ButtonShare" Tag="share" Content="SHARE" Visibility="{Binding IsEditingTool, Converter={StaticResource BooleanToVisibilityConverter}}" />
<NavigationViewItemSeparator />
<NavigationViewItem x:Uid="ButtonSettings" Tag="settings" Content="SETTINGS" />
<NavigationViewItem x:Uid="ButtonAbout" Tag="about" Content="ABOUT" />
</NavigationView.MenuItems>
<Frame Name="RootFrame"/>
</NavigationView>