Hi,
I am trying to use several radcontextmenu on same xaml page. And graphically it works fine . But on my output I have serveral errors :
This error happens when i open successively two different radcontextmenu.
Scenario :
- The first radcontextMenu clicked on, contains only leaves
- The second radcnctextMenu clicked on, contains on first level only root nodes (Role = Submenuheader?)
Below the code of my page :
It seams there is only one instance of RadContextMenu for all RadContextMenu i have in my page.. If it's the case, i would know why the role=sumbmenuheader style is also applied on leaves ?
Thank you in advance for your help
I am trying to use several radcontextmenu on same xaml page. And graphically it works fine . But on my output I have serveral errors :
System.Windows.Data Error: 4 : Cannot find source for binding with reference |
'RelativeSource FindAncestor, |
AncestorType='Telerik.Windows.Controls.RadContextMenu', AncestorLevel='1''. |
BindingExpression:Path=DataContext.SelectIrisV2CodesCommand; DataItem=null; |
target element is 'EventToCommand' (HashCode=11696593); target property is |
'Command' (type 'ICommand') |
This error happens when i open successively two different radcontextmenu.
Scenario :
- The first radcontextMenu clicked on, contains only leaves
- The second radcnctextMenu clicked on, contains on first level only root nodes (Role = Submenuheader?)
Below the code of my page :
<Style x:Key="IrisRadMenuItemStyle" TargetType="{x:Type telerik:RadMenuItem}"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:RadMenuItem}"> |
<Grid x:Name="RootElement" Background="{TemplateBinding Background}" Margin="2" > |
<i:Interaction.Triggers> |
<i:EventTrigger EventName="MouseLeftButtonDown"> |
<cmd:EventToCommand Command="{Binding DataContext.SelectIrisV2CodesCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerikNavigation:RadContextMenu}}, Mode=OneWay}" CommandParameter="{Binding}" /> |
</i:EventTrigger> |
</i:Interaction.Triggers> |
... |
</Setter.Value> |
</Setter> |
<Style.Triggers> |
<Trigger Property="Role" Value="SubmenuHeader"> |
<Setter Property="Template"> |
<Setter.Value> |
<ControlTemplate TargetType="{x:Type telerik:RadMenuItem}"> |
<Grid x:Name="RootElement" Background="{TemplateBinding Background}" Margin="2"> |
<i:Interaction.Triggers> |
<i:EventTrigger EventName="MouseEnter"> |
<cmd:EventToCommand Command="{Binding DataContext.ShowIrisCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerikNavigation:RadContextMenu}}, Mode=OneWay}" CommandParameter="{Binding}" /> |
</i:EventTrigger> |
</i:Interaction.Triggers> |
... |
</Trigger> |
</Style.Triggers> |
</Style> |
<ToggleButton Grid.Row="1" Grid.Column="2" Width="20" IsChecked="{Binding IsOpen, ElementName=Nav, Mode=TwoWay}"> |
<telerikNavigation:RadContextMenu.ContextMenu > |
<telerikNavigation:RadContextMenu EventName="MouseLeftButtonDown" Name="Nav" |
ItemContainerStyle="{DynamicResource IrisRadMenuItemStyle}" Style="{DynamicResource IrisRadContextMenuStyle}" ItemsSource="{Binding IrisCodes}" > |
<telerikNavigation:RadContextMenu.ItemTemplate> |
<HierarchicalDataTemplate ItemsSource="{Binding IrisCodes}" /> |
</telerikNavigation:RadContextMenu.ItemTemplate> |
</telerikNavigation:RadContextMenu> |
</telerikNavigation:RadContextMenu.ContextMenu> |
<Image Source="/Solmis.Client;component/Images/16/view.png" /> |
</ToggleButton> |
... |
<ToggleButton Grid.Row="2" Grid.Column="2" Width="20" IsChecked="{Binding IsOpen, ElementName=NavCOE, Mode=TwoWay}"> |
<telerikNavigation:RadContextMenu.ContextMenu > |
<telerikNavigation:RadContextMenu EventName="MouseLeftButtonDown" Name="NavCOE" |
ItemContainerStyle="{DynamicResource IrisRadMenuItemStyle}" Style="{DynamicResource IrisRadContextMenuStyle}" ItemsSource="{Binding IrisCodes}" > |
<telerikNavigation:RadContextMenu.ItemTemplate> |
<HierarchicalDataTemplate ItemsSource="{Binding IrisCodes}" /> |
</telerikNavigation:RadContextMenu.ItemTemplate> |
</telerikNavigation:RadContextMenu> |
</telerikNavigation:RadContextMenu.ContextMenu> |
<Image Source="/Solmis.Client;component/Images/16/view.png" /> |
</ToggleButton> |
It seams there is only one instance of RadContextMenu for all RadContextMenu i have in my page.. If it's the case, i would know why the role=sumbmenuheader style is also applied on leaves ?
Thank you in advance for your help