Hi
I'm trying to pass XamDataGrid on XamMenuItem CommandParameter but it always null.
xaml code:
<ig:XamMenuItem Header="Test" Command="{Binding TestCommand}" CommandParameter="{Binding Path=ActiveCell, Source={x:Reference RatioGrid2}}"> </ig:XamMenuItem>
ModelView Code:
this.TestCommand = new RelayCommand<object>(Test_Execute, Test__CanExecute);
private async void Test_Execute(object selectedcell) {
}
But selectedcell is always null..
Thank you
Hello Deloitte,
Thank you for the code-snippet you have provided.
I tested the behavior you have described in regards to binding the CommandParameter of a XamMenuItem to the ActiveCell of a XamDataGrid and I was not able to reproduce it.
XAML:
...<ig:XamMenuItem Header="Test" Command="{Binding Path=TestCommand}" CommandParameter="{Binding Path=ActiveCell, Source={x:Reference dataGrid}}" />...<igDP:XamDataGrid Grid.Row="1" x:Name="dataGrid" DataSource="{Binding Path=Items}" />
TestCommand = new DelegatedCommand(p => { if (p == null) MessageBox.Show("No ActiveCell"); else MessageBox.Show("ActiveCell: " + (p as Cell).Value);});
If no cell is currently active in the XamDataGrid, it is expected for the ActiveCell property to be null.
I have attached a sample application that demonstrates the approach from above. Would you please modify it so the issue is reproduced and send it back to me? Having this information will help me further investigate this matter for you.
If you have any questions, please let me know.