Hi guys,
I have this XAML
<telerik:RadTreeListView AutoGenerateColumns="False" ItemsSource="{Binding Categories}" SelectedItem="{Binding SelectedCategory,Mode=TwoWay}">
<telerik:RadContextMenu.ContextMenu>
<telerik:RadContextMenu x:Name="CategoryContextMenu" Opened="CategoryContextMenu_Opened">
<telerik:RadMenuItem Header="Aggiungi" />
</telerik:RadContextMenu>
</telerik:RadContextMenu.ContextMenu>
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Categories}" />
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Description}" Header="Categoria" />
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding Positive}" Header="Positivo" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
Now, if I click on anything node, enter in CategoryContextMenu_Opened but GetClickedElement return null ever!
private void CategoryContextMenu_Opened(object sender, RoutedEventArgs e)
{
RadTreeViewItem item = this.CategoryContextMenu.GetClickedElement<RadTreeViewItem>();
if (item != null) //It never true!!!
{
viewModel.SelectedCategory = (LocalCategory)item.DataContext; //Can I do it?
}
}