I am trying to bind to command that is on my viewmodel. I am using an event trigger that is way down on the visual tree. I have tried many variations of RelativeSource, FindAncestor and AncestorType trying to bind to it. Every time I get a bind path expression error.
This is my xaml document outline:
<Window>
<Grid>
<GridView>
<HierarchyChildTemplate>
<DataTemplate>
<TabControl>
<TabItem>
<GridView>
<RowDetailsTemplate>
<TabControl>
<!--trying to bind a event trigger here to a command on the viewModel -->
Here is an example of the binding I've tried:
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding Path=SelectionChangedCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
How would I bind to this command from the location noted in the xaml?
Path=DataContext.SelectionChangedCommand
instead of just SelectionChangedCommand? – Blachshma