Reduce indentation on radviewitems

3 posts, 0 answers
  1. James Molohon
    James Molohon avatar
    6 posts
    Member since:
    Jan 2009

    Posted 03 Nov 2010 Link to this post

    Is there a way I could reduce the indentation on the treeview items using a property. I could decrease the identation by decreasing the margin on the stackpanel of the items but when I hover over the items, the highlight of the items is still off(as shown in the attached image).
    Here's the code which I am using:
    <telerik:RadTreeView   x:Name="q" HorizontalAlignment="Left" ScrollViewer.HorizontalScrollBarVisibility="Hidden"                              Margin="0"  IsExpandOnSingleClickEnabled="True" IsLineEnabled="False" IsRootLinesEnabled="False" IsTriStateMode="True">                                <telerik:RadTreeViewItem   Header="Data 1" Padding="0" IsExpanded="True" IsTabStop="False" FontSize="12">
       <StackPanel Orientation="Horizontal" Margin="-18,5,5,0" >
           <TextBlock Text="Item 1 " FontWeight="Bold" FontSize="11"></TextBlock>
           <TextBlock Text="Item 4 " FontWeight="Bold" FontSize="11"></TextBlock>
        </StackPanel>
    </telerik:RadTreeViewItem>
    <telerik:RadTreeViewItem Header="Data 2" FontSize="12" IsExpanded="True" >
         <StackPanel Orientation="Horizontal" Margin="-18,5,10,0" >
                <TextBlock Text="Item 1" FontWeight="Bold" FontSize="11"></TextBlock>
         </StackPanel>
    </telerik:RadTreeViewItem>
    <telerik:RadTreeViewItem Header="Data 3" FontSize="12" IsExpanded="True" >
         <StackPanel Orientation="Horizontal" Margin="-18,5,5,0" >
               <TextBlock Text="Item1  " FontWeight="Bold" FontSize="11"></TextBlock>
          </StackPanel>
          <StackPanel Orientation="Horizontal" Margin="-18,5,5,0" >
                <TextBlock Text="Item 2" FontWeight="Bold" FontSize="11"></TextBlock>
          </StackPanel>
          <StackPanel Orientation="Horizontal" Margin="-18,5,5,0" >
               <TextBlock Text="Item 3 " FontWeight="Bold" FontSize="11"></TextBlock>
           </StackPanel>
    </telerik:RadTreeViewItem>
    <telerik:RadTreeViewItem Header="Data 3" IsExpanded="True" Padding="0" FontSize="12">
        <StackPanel Orientation="Horizontal" Margin="-18,5,5,0" >
            <TextBlock Text="Item 1" FontWeight="Bold" FontSize="11"></TextBlock>
        </StackPanel>
    </telerik:RadTreeViewItem>
    </telerik:RadTreeView>

    Thanks in advance for the help.
    Thanks!
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 08 Nov 2010 Link to this post

    Hello James Molohon,

    A possible workaround to your issue is to "wrap" the StackPanels that contain the TextBlocks in a RadTreeViewItem.  Then you can set the Margin of the RadTreeViewItem instead of the StackPanel and this will lead to the desired appearance. I modified your solution accordingly ( changes are  in RadTreeViewitem with Header="Data 3" ). Please examine it and let me know if it satisfies you. We would be glad if we can help you further if you need it.

    Best wishes,
    Petar Mladenov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. James Molohon
    James Molohon avatar
    6 posts
    Member since:
    Jan 2009

    Posted 08 Nov 2010 Link to this post

    Hello Petar,

    Thanks a lot for the solution, that works great.

    Thanks,
    James.
Back to Top