語言

NavigationCommands.Favorites 屬性

定義

取得代表指令的 Favorites 值。

public:
 static property System::Windows::Input::RoutedUICommand ^ Favorites { System::Windows::Input::RoutedUICommand ^ get(); };
public static System.Windows.Input.RoutedUICommand Favorites { get; }
static member Favorites : System.Windows.Input.RoutedUICommand
Public Shared ReadOnly Property Favorites As RoutedUICommand

屬性值

路由的 UI 指令。

預設值
關鍵手勢 CTRL+I
使用者介面文字 最愛

範例

以下範例展示如何實作能回應指令的 Favorites 程式碼,並結合 Frame。

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

備註

此指令表示意圖管理並導向最愛。

目前沒有任何實作可以回應任何給定 WPF 類別的 Favorites 指令。 因此,你需要提供適當的實作方式,如範例所示。

XAML 屬性使用方式

<object property="NavigationCommands.Favorites"/>

適用於

另請參閱