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

Reduce indentation on radviewitems

2 Answers 123 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
James Molohon
Top achievements
Rank 2
James Molohon asked on 03 Nov 2010, 03:03 PM
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 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 08 Nov 2010, 11:27 AM
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
0
James Molohon
Top achievements
Rank 2
answered on 08 Nov 2010, 04:11 PM
Hello Petar,

Thanks a lot for the solution, that works great.

Thanks,
James.
Tags
TreeView
Asked by
James Molohon
Top achievements
Rank 2
Answers by
Petar Mladenov
Telerik team
James Molohon
Top achievements
Rank 2
Share this question
or