Context menu for TreeColumn

2 posts, 0 answers
  1. Anne Lyon
    Anne Lyon avatar
    87 posts
    Member since:
    Jan 2010

    Posted 14 Jan 2013 Link to this post

    Hi, I would like to attach a context menu to a tree-column in the task-tree. Preferable only child tasks and not parent (summary) tasks.
    I have implemented the code in one of your examples (RadContextMenu_MVVM) and the context menu works fine if I for instance attach it to an EventContainer:
    in MainPage.xaml:
    <Setter Property="telerik:RadContextMenu.ContextMenu" Value="{Binding Path=ContextMenu, Source={StaticResource ContextMenuHolder}}" />

    But if I add the same line for a TreeCellContainer the context menu does not display:

    <Style TargetType="telerik:TreeCellContainer" BasedOn="{StaticResource TreeCellEContainerStyle}">
        <Setter Property="telerik:RadContextMenu.ContextMenu" Value="{Binding Path=ContextMenu, Source={StaticResource ContextMenuHolder}}" />
    </Style>

    My treeView columns are defined like this:
    <telerik:RadGanttView.Columns>
         <telerik:ColumnDefinition  Header="Progress" ColumnWidth="40" >
             <telerik:ColumnDefinition.CellTemplate>
                 <DataTemplate>
                     <StackPanel Orientation="Horizontal">
                          <Image x:Name="imgKlipp" Source="{Binding Progress, Converter={StaticResource DblToImageConverter}}" HorizontalAlignment="Right" Stretch="None" />
                     </StackPanel>
                 </DataTemplate>
             </telerik:ColumnDefinition.CellTemplate>
         </telerik:ColumnDefinition>
           
         <telerik:TreeColumnDefinition Header="AO'er" MemberBinding="{Binding Title}" ColumnWidth="160">
         </telerik:TreeColumnDefinition>
     </telerik:RadGanttView.Columns>

    It is only the TreeColumnDefinition I want a context menu for, NOT the ColumnDefinition.
    Am I using the right target container for the items in the treeview? How do I make sure only the child tasks/events have a context menu in the task tree and not the parent summarty tasks?

    Anne
  2. Ventzi
    Admin
    Ventzi avatar
    114 posts

    Posted 15 Jan 2013 Link to this post

    Hello Anne,

    I've noticed that you have the same forum post here where I answered your question. Please let's continue our conversation there.

    All the best,
    Ventzi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top