Trying to Capture ItemTapped Event in ViewModel

I'm trying to capture the ItemTapped event for an sfTreeView control (in WPF). Unfortunately when I click on a node nothing happens.

Here is the XAML snippet:

Grid.Column="1" Grid.Row="0"
Grid.ColumnSpan="2"
Margin="5"
ItemsSource="{Binding RootCategories}"
NotificationSubscriptionMode="PropertyChange"
NodePopulationMode="Instant"
ChildPropertyName="ChildNodes">




VerticalAlignment="Center"
IsChecked="{Binding IsSelected}"/>

VerticalAlignment="Center"
Text="{Binding DisplayName}"/>



ChildPropertyName="ChildCategories"
TargetType="db:Category"/>








And here is the MVVM code:

// in the constructor
ItemTapped = new RelayCommand( ItemTappedHandler );


// later on in the MVVM code:

public RelayCommand ItemTapped { get; }


private void ItemTappedHandler( ItemTappedEventArgs? e )
{
/
}




1 Reply

MA Mohanram Anbukkarasu Syncfusion Team December 29, 2021 02:10 PM UTC

Hi Mark,


ItemTapped event is working properly in our end. We are unclear about the way you have used the ItemTapped event in MVVM. If your requirement is not to handle events in code behind, then you can use Behavior to handle events. Otherwise kindly provide more clear details with complete code snippets or revert to us with a simple sample to replicate the issue. It will be more helpful for us to find the exact cause for the issue and to provide a prompt solution.


Regards,

Mohanram A.


Loader.
Up arrow icon