This is a migrated thread and some comments may be shown as answers.

Access to the context menu in resources

1 Answer 95 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 15 Oct 2013, 02:43 PM
Hi,

I have a radTreeView defined with its context menu in resources::

<UserControl.Resources>
    <sampleData:c_treeViewData x:Key="DataSource"/>
    <Style x:Key="ItemContainerStyle" TargetType="telerik:RadTreeViewItem">
        <Setter Property="IsExpanded" Value="True"/>
    </Style>
    <DataTemplate x:Key="ItemEditTemplate">
        <Grid>
 
            <StackPanel Orientation="Horizontal">
                <TextBox Text="{Binding Name, Mode=TwoWay}"/>
            </StackPanel>
 
        </Grid>
    </DataTemplate>
     
    <DataTemplate x:Key="c_proprietyValue">
        <TextBlock Text="{Binding Name}" FontSize="14" TextWrapping="Wrap" Width="200" />
    </DataTemplate>
 
 
    <HierarchicalDataTemplate x:Key="c_proprietyType" ItemTemplate="{StaticResource c_proprietyValue}"
       ItemsSource="{Binding propretyValues}">
        <StackPanel Orientation="Horizontal">
        <Image Source="{Binding Image}" Margin=" 0,0,6,0" Height="20" Width="20" />
        <TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="14">
              <telerik:RadContextMenu.ContextMenu >
                    <telerik:RadContextMenu Name="rcm_context1" Opened="RadContextMenu_Opened">
                    <telerik:RadMenuItem Name="Delete" Header="Delete" />
                    <telerik:RadMenuItem Name="Contraer" Header="Collapse tree" />
                    <telerik:RadMenuItem Name="Expandir" Header="Expand tree" />
                </telerik:RadContextMenu>
              </telerik:RadContextMenu.ContextMenu>
             
        </TextBlock>
        </StackPanel>
    </HierarchicalDataTemplate>
 
    <HierarchicalDataTemplate x:Key="c_block" ItemTemplate="{StaticResource c_proprietyType}"
       ItemsSource="{Binding propretyTypes}" >
        <StackPanel Orientation="Horizontal">
            <Image Source="{Binding Image}" Margin=" 0,0,6,0" Height="20" Width="20" />
             
            <TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="16" HorizontalAlignment="Stretch">
             
    <telerik:RadContextMenu.ContextMenu>
        <telerik:RadContextMenu Opened="RadContextMenu_Opened">
            <telerik:RadMenuItem Name="Rename" Header="Rename" />
            <telerik:RadMenuItem Name="Delete" Header="Delete" />
            <telerik:RadMenuItem Name="Contraer" Header="Collapse tree" />
            <telerik:RadMenuItem Name="Expandir" Header="Expand tree" />
        </telerik:RadContextMenu>
    </telerik:RadContextMenu.ContextMenu>
 
            </TextBlock>
 
        </StackPanel>
    </HierarchicalDataTemplate>
 
 
 
</UserControl.Resources>


I want to access the context menu to change the headers of the items depending on the country. 
Can you help me, please? I'm using VB.NET

Thanks

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 15 Oct 2013, 03:22 PM
I've found a solution to my problem, thanks anyway
Tags
ContextMenu
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or