Bagikan melalui


NavigationCommands.BrowseHome Properti

Definisi

Mendapatkan nilai yang mewakili Browse Home perintah .

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

Nilai Properti

Perintah UI yang dirutekan.

Nilai Default
Gerakan Kunci ALT+HOME
Teks UI Beranda

Contoh

Contoh berikut menunjukkan cara mengimplementasikan kode yang merespons BrowseHome perintah bersama dengan 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

Keterangan

Perintah ini menunjukkan niat untuk menavigasi ke rumah.

Tidak ada implementasi untuk menanggapi BrowseHome perintah pada kelas WPF tertentu. Dengan demikian, Anda perlu memberikan implementasi yang sesuai, yang ditunjukkan dalam contoh.

Penggunaan Atribut XAML

<object property="NavigationCommands.BrowseHome"/>  

Berlaku untuk

Lihat juga