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 文本 | 主页 |
示例
以下示例演示如何实现与 一起Frame响应 BrowseHome 命令的代码。
<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"/>