I have created a Grid with ItemTemplate and now on click of any item I want user to navigate to new screen. I have added ICommand function in ViewModel for this but I am not able to handle the Command event in this. Also I am not sure how to display a new window above current one(like Stackview). Following is my XAML:
<ItemsControl Grid.Row="2" x:Name="FingerPrintItemsControl" ItemsSource="{Binding FingerPrints}"
BorderThickness="0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<controls:IconButton Command="{Binding SelectFingerPrintCommand}" CommandParameter="{Binding}" Style="{StaticResource IconButton}" Label="{Binding Name}" Icon="{StaticResource IconDefault}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="3" Rows="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
My ViewModel:
public ICommand SelectFingerPrintCommand => _selectFingerPrintCommand ??= new RelayCommand<object>(OnSelectFingerPrintCommand, CanSelectFingerPrint);
private bool CanSelectFingerPrint(object param)
{
return true;
}
private void OnSelectFingerPrintCommand(object param)
{
if (param == null) { return; }
var fingerPrint = (FingerPrintViewModel)param;
}
private ObservableCollection<FingerPrintViewModel>? _fingerPrints;
private ICommand? _selectFingerPrintCommand;
I am not even able to get debugger in OnSelectFingerPrintCommand. So it looks there is some problem in my Command also. Can someone please help me?