WPF ウィンドウまたは WPF ページを作成している場合は、コマンドを XAML 内の関数にバインドできます。
<Page x:Class="WpfPageApplication.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:WpfPageApplication="clr-namespace:WpfPageApplication"
Title="Page1" Background="LightGray"
>
<Page.CommandBindings>
<CommandBinding
Command="WpfPageApplication:PizzaCommands.ConfigurePizza"
Executed="OnConfigurePizza" />
</Page.CommandBindings>
別のタイプの WPF フォームがあります: a PageFunction
. ただし、次のように入力することはできません。
<PageFunction.CommandBindings>
2 つの考えられる説明を推測できます。
PageFunction
はジェネリック オブジェクトであるため、何らかの方法でジェネリック パラメーターを XAML に入力する必要があります。- それはフレームワークの矛盾です。
XAML 内でを構成CommandBindings
する方法を知っている人はいますか? PageFunction
(コードでできることは知っていますが、それは重要ではありません)。