TitleBar.IsPaneToggleButtonVisible 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會取得或設定一個值,指示是否顯示切換導航面板的按鈕。
public:
property bool IsPaneToggleButtonVisible { bool get(); void set(bool value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
bool IsPaneToggleButtonVisible();
void IsPaneToggleButtonVisible(bool value);
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
bool IsPaneToggleButtonVisible();
void IsPaneToggleButtonVisible(bool value);
public bool IsPaneToggleButtonVisible { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")] set; }
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")]
public bool IsPaneToggleButtonVisible { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="false")] set; }
var boolean = titleBar.isPaneToggleButtonVisible;
titleBar.isPaneToggleButtonVisible = boolean;
Public Property IsPaneToggleButtonVisible As Boolean
屬性值
Boolean
bool
true如果顯示切換導航面板的按鈕;否則,。 false 預設值為 false。
- 屬性
-
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute
範例
<!-- MainWindow.xaml -->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TitleBar Title="My App"
IsPaneToggleButtonVisible="True"
PaneToggleRequested="TitleBar_PaneToggleRequested">
</TitleBar>
<NavigationView x:Name="RootNavigationView" Grid.Row="1"
IsPaneToggleButtonVisible="False">
<Frame x:Name="RootFrame" />
</NavigationView>
</Grid>
// MainWindow.xaml.cs
private void TitleBar_PaneToggleRequested(TitleBar sender, object args)
{
RootNavigationView.IsPaneOpen = !RootNavigationView.IsPaneOpen;
}
備註
當你用 標題列 控制項搭配 導航檢視 控制時,應該把導航檢視的面板切換按鈕替換成標題欄的面板切換按鈕。
我們建議您:
- 在控制鍵
NavigationView裡隱藏面板切換按鈕。<NavigationView IsPaneToggleButtonVisible="False"> - 在控制面板中顯示切換面板按鈕
TitleBar。<TitleBar IsPaneToggleButtonVisible="True"> - 處理 TitleBar.PaneToggleRequested 事件,切換 NavigationPane.IsPaneOpen 屬性的值。