Прочетете на английски Редактиране

Споделяне чрез


NavigationCommands.Favorites Property

Definition

Gets the value that represents the Favorites command.

C#
public static System.Windows.Input.RoutedUICommand Favorites { get; }

Property Value

The routed UI command.

Default Values
Key Gesture CTRL+I
UI Text Favorites

Examples

The following example shows how to implement code that responds to the Favorites command in conjunction with a Frame.

XAML
<Window
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  x:Class="SDKSample.Favorites">
XAML
<!-- NavigationCommands.Favorites -->
<MenuItem Command="NavigationCommands.Favorites">
  <MenuItem.CommandBindings>
    <!-- NavigationCommands.Favorites Binding-->
    <CommandBinding
      Command="NavigationCommands.Favorites"
      CanExecute="navigationCommandFavorites_CanExecute"
      Executed="navigationCommandFavorites_Executed" />
  </MenuItem.CommandBindings>
</MenuItem>
XAML
<Frame Name="frame" NavigationUIVisibility="Hidden" Source="Page1.xaml" />
XAML
</Window>

Remarks

This command indicates the intention to manage and navigate to favorites.

There is no implementation for responding to the Favorites command on any given WPF class. As such, you need to provide an appropriate implementation, which is shown in the example.

XAML Attribute Usage

<object property="NavigationCommands.Favorites"/>  

Applies to

Продукт Версии
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also