I am working with SyncFusion's TreeView. I have a TreeView with three separate DataTemplate/Custom View Cells. In my main XAML, I have the following tree view code below which binds to my DataTemplates.
SamplePage.xaml
<syncfusion:SfTreeView x:Name="treeView"
QueryNodeSize="TreeView_QueryNodeSize"
NodeSizeMode="Dynamic"
AutoExpandMode="RootNodesExpanded"
ChildPropertyName="SubFiles"
ItemsSource="{Binding ImageNodeInfo}" Indentation="0"
ItemTemplate="{StaticResource TemplateSelector}">
</syncfusion:SfTreeView>
I am now trying to bind my command from one of my data templates (code below) to my view model connected to my page but I can't seem to connect my data bindings. Most examples online shows the data template on the same xaml page of the view / viewModel. However, my code is using a data template selector which gives me a harder route to bind.
SampleTemplate.xaml
<ViewCell.BindingContext>
<local:SamplePage x:Key="SamplePage">
</local:SamplePage>
</ViewCell.BindingContext>
<ImageButton Aspect="AspectFill"
Grid.Row="0" Grid.Column="3"
HorizontalOptions="End"
WidthRequest="90" HeightRequest="90"
Source="{xaml:ImageResource plus_Icon}"
Command="{Binding Path=BindingContext.AddAsJobClickedCommand}, Source={x:Reference SamplePage}"
CommandParameter="{Binding treeView}"
/>