i have writte a custom ICommand
implementation which is available as a static property:
public class GridViewCommands
{
public GridViewCommands()
{
}
/// <summary>
/// Toggle Selection-Command
/// </summary>
public static ICommand ToggleSelection
{
get
{
return new GridViewToggleSelectionCommand();
}
}
}
I try to bind this property to a simple 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>
But if i start my application, the parameter
-Parameter in the CanExecute
method in GridViewToggleSelectionCommand
is always null. My aim is to pass an instance of GridViewControl
as the command parameter.
What am i doing wrong here: ui:GridViewCommands.ToggleSelection}" CommandParameter="{Binding ElementName=gridView"}
?
EDIT
The binding does not throw any exception.
Thank you very much!