NavigationCommands.BrowseHome 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得代表指令的 Browse Home 值。
public:
static property System::Windows::Input::RoutedUICommand ^ BrowseHome { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand BrowseHome { get; }
static member BrowseHome : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property BrowseHome As RoutedUICommand
屬性值
路由的 UI 指令。
| 預設值 | |
|---|---|
| 關鍵手勢 | 替代+首頁 |
| 使用者介面文字 | 首頁 |
範例
以下範例展示如何實作能回應指令的 BrowseHome 程式碼,並結合 Frame。
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="SDKSample.BrowseHome">
<!-- NavigationCommands.BrowseHome -->
<MenuItem Command="NavigationCommands.BrowseHome">
<MenuItem.CommandBindings>
<!-- NavigationCommands.BrowseHome Binding-->
<CommandBinding
Command="NavigationCommands.BrowseHome"
CanExecute="navigationCommandBrowseHome_CanExecute"
Executed="navigationCommandBrowseHome_Executed" />
</MenuItem.CommandBindings>
</MenuItem>
<Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />
</Window>
using System.Windows;
using System.Windows.Input;
namespace SDKSample
{
public partial class BrowseHome : Window
{
public BrowseHome()
{
InitializeComponent();
}
void navigationCommandBrowseHome_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
// Can always navigate home
e.CanExecute = true;
}
void navigationCommandBrowseHome_Executed(object target, ExecutedRoutedEventArgs e)
{
// Implement custom BrowseHome handling code
}
}
}
Namespace SDKSample
Partial Public Class BrowseHome
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub navigationCommandBrowseHome_CanExecute(ByVal sender As Object, ByVal e As CanExecuteRoutedEventArgs)
' Can always navigate home
e.CanExecute = True
End Sub
Private Sub navigationCommandBrowseHome_Executed(ByVal target As Object, ByVal e As ExecutedRoutedEventArgs)
' Implement custom BrowseHome handling code
End Sub
End Class
End Namespace
備註
此指令表示意圖導航回家。
目前沒有任何實作可以回應任何給定 WPF 類別的 BrowseHome 指令。 因此,你需要提供適當的實作方式,如範例所示。
XAML 屬性使用方式
<object property="NavigationCommands.BrowseHome"/>