Silverlight - Space between the top of the TreeView and the first TreeViewItem
I have a question related to This .
How can you change the spacing between the top of the TreeView control and the first TreeViewItem? Specifically, I want to REDUCE the space between the top of the control and the first item. As with the other question, I am guessing that I will need to redo the TreeView. But what style do I need for chnage and what property controls this particular space?
Thanks in advance.
+1
a source to share
2 answers
I got my question about Silverlight answered, net forums here . Essentially I needed to add a control template and change the field to ItemPresenter.
<ctl:TreeView>
<ctl:TreeView.Template>
<ControlTemplate TargetType="ctl:TreeView">
<Grid x:Name="Root" >
<Grid.Resources>
<SolidColorBrush x:Key="BorderBrush" Color="#FF000000" />
</Grid.Resources>
<Border x:Name="Border" BorderBrush="{StaticResource BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}" Margin="1">
<ScrollViewer x:Name="ScrollViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" Background="{x:Null}" BorderBrush="Transparent" BorderThickness="0" IsTabStop="False" TabNavigation="Once">
<ItemsPresenter x:Name="TreeItems" Margin="5" />
</ScrollViewer>
</Border>
</Border>
</Grid>
</ControlTemplate>
</ctl:TreeView.Template>
<ctl:TreeView>
+1
a source to share