ICommand
私は静的プロパティとして利用可能なカスタム実装を書きました:
public class GridViewCommands
{
public GridViewCommands()
{
}
/// <summary>
/// Toggle Selection-Command
/// </summary>
public static ICommand ToggleSelection
{
get
{
return new GridViewToggleSelectionCommand();
}
}
}
このプロパティをシンプルにバインドしようとしましたButton-Command
<ui:GridViewControl x:Name="gridView" Grid.Row="1" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
<Button HorizontalAlignment="Left" Width="100" Margin="220,0,0,0" Content="Toggle" x:Name="toggleButton" Command="{x:Static ui:GridViewCommands.ToggleSelection}" CommandParameter="{Binding ElementName=gridView}"></Button>
しかし、アプリケーションを起動すると、メソッドのparameter
-Parameterは常に null になります。私の目的は、のインスタンスをコマンド パラメーターとして渡すことです。CanExecute
GridViewToggleSelectionCommand
GridViewControl
ここで何が間違っていますか: ui:GridViewCommands.ToggleSelection}" CommandParameter="{Binding ElementName=gridView"}
?
編集
バインディングは例外をスローしません。
どうもありがとうございました!