RadTreeView nested in RadTreeView

5 posts, 1 answers
  1. Alex Olenev
    Alex Olenev avatar
    9 posts
    Member since:
    Oct 2009

    Posted 12 Sep 2011 Link to this post

    Hi

    If I want to put in one RadTreeView another RadTreeView instead of RadTreeViewItem (TreeView in TreeView). With MouseOver this nested TreeView Highlighted with Yellow color. But I don't want this yellow background. How can I get it with tranparent background (the parent TreeViewItem style hasn't yellow background)?

    P.S.
    The source of this problem: needed Drag&Drop in TreeView but not in hole treeview - only for the part of it (for one section)
  2. Answer
    Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 15 Sep 2011 Link to this post

    Hello Alex Olenev,

    I prepared a sample for you.Basically I have the following RadTreeView declaration:

    <telerik:RadTreeView  >
              <telerik:RadTreeViewItem Header="Item A"  />
              <telerik:RadTreeViewItem Header="Item B" />
              <telerik:RadTreeViewItem Header="Item Containing TreeView" ItemContainerStyle="{StaticResource RadTreeViewItemStyle1}">
                  <telerik:RadTreeView x:Name="innerTreeView" Background="DeepSkyBlue">
                      <telerik:RadTreeViewItem Header="Inner TreeItem 1" />
                      <telerik:RadTreeViewItem Header="Inner TreeItem 2" />
                      <telerik:RadTreeViewItem Header="Inner TreeItem 3" />
                  </telerik:RadTreeView>
              </telerik:RadTreeViewItem>
          </telerik:RadTreeView>
    I edited the default Style of the RadtreeViewItem and used it as an ItemContainerStyle of the TreeItem that  holds the inner RadTreeView. Please keep in mind here that everything that is placed in the XAML body of a RadtreeViewItem then gets wrapped in a RadTreeViewItem too.
    The Style change that I made was to comment the MouseOver VisualState:
    <ControlTemplate x:Key="TreeViewItemDefaultTemplate" TargetType="telerik:RadTreeViewItem">
                <Grid x:Name="RootElement">
                                 .....
                                    <VisualStateManager.VisualStateGroups>
                                     ............
                                    <VisualStateGroup x:Name="CommonStates">
                                        ......
                                            <!--<VisualState x:Name="MouseOver">
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.1" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="MouseOverVisual"/>
                                </Storyboard>
                            </VisualState>-->
    Please let us know if this satisfies you or not.We would be glad to help you further.


    Regards,
    Petar Mladenov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Alex Olenev
    Alex Olenev avatar
    9 posts
    Member since:
    Oct 2009

    Posted 16 Sep 2011 Link to this post

    Thank you very much. It's very usefull for me
  5. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 19 Jul 2012 Link to this post

    Perfect, and would you please demonstrate the same for asp.net Ajax, I meant the .aspx page ?

    Thanks in advacne,
    -Aarsh
  6. Aarsh
    Aarsh avatar
    192 posts
    Member since:
    Jun 2012

    Posted 20 Jul 2012 Link to this post

    Thanks Princy, the scenario I requested above is being answered at the following "permlink"

    http://www.telerik.com/community/forums/aspnet-ajax/treeview/nesting-treeview-programatically.aspx#2194882

    Thanks,
    -Aarsh
Back to Top
DevCraft banner