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命令。
預設值 | |
---|---|
按鍵動作 | ALT+HOME |
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 Attribute Usage
<object property="NavigationCommands.BrowseHome"/>