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

can't change the style of line of TreeView

4 Answers 89 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
liu
Top achievements
Rank 1
liu asked on 18 Nov 2010, 12:03 PM

Hi,I want to make the line change from Solidline to line of dashes. But there is a line I can't control it .
The codes:
There are three lines I can control, and there is another line I can't control, you can see the image attached.

<StackPanel x:Name="IndentContainer" Orientation="Horizontal">
                        <Rectangle x:Name="IndentFirstVerticalLine" StrokeDashArray="1 2" Stroke="{StaticResource TreeView_LineColor}" Visibility="Collapsed" VerticalAlignment="Top" Width="1">
                            <Rectangle.Clip>
                                <RectangleGeometry Rect="0,0,1,10000"/>
                            </Rectangle.Clip>
                        </Rectangle>
                    </StackPanel>
                    <Grid x:Name="ListRootContainer" Grid.Column="1" HorizontalAlignment="Center" MinWidth="20">
                        <Rectangle x:Name="HorizontalLine" StrokeDashArray="1 2" HorizontalAlignment="Right" Height="1" Stroke="{StaticResource TreeView_LineColor}" VerticalAlignment="Center">
                            <Rectangle.Clip>
                                <RectangleGeometry Rect="0,0,10000,1"/>
                            </Rectangle.Clip>
                        </Rectangle>
                        <Rectangle x:Name="VerticalLine" StrokeDashArray="1 2" HorizontalAlignment="Center" Stroke="{StaticResource TreeView_LineColor}" VerticalAlignment="Top" Width="1">
                            <Rectangle.Clip>
                                <RectangleGeometry Rect="0,0,1,10000"/>
                            </Rectangle.Clip>
                        </Rectangle>
                        <ToggleButton x:Name="Expander" Background="Red" IsTabStop="False" Style="{StaticResource ToggleButtonStyle}"/>
                        <Grid x:Name="LoadingVisual" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" Visibility="Collapsed" VerticalAlignment="Center">
                            <Grid.RenderTransform>
                                <TransformGroup>
                                    <RotateTransform x:Name="LoadingVisualAngleTransform" Angle="0" CenterY="0.5" CenterX="0.5"/>
                                </TransformGroup>
                            </Grid.RenderTransform>
                        </Grid>
                    </Grid>

And how can I change the style of the expander? I want to change the color.

Thanks very much.

4 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 23 Nov 2010, 07:15 PM
Hi liu,

You need to edit the IndentFirstVerticalLine, VerticalLine and HorizontalLine elements in order to achieve the desired effect  on the lines of the RadTreeView. Just ensure that you set the tree`s IsLineEnabled and IsRootLinesEnabled properties to True and apply the RadTreeViewtemStyle to all of the tree`s RadTreeViewItems.

In order to change the expander`s  visual appearance you can set the ExpanderStyle property of the RadTreeView. The expander element is a ToggleButton and you can edit its default style by editing the ControlTemplate of the RadTreeView. Then you need to play with the Fills of the Paths named CollapsedVisual , CollapsedVisualOver, ExpandedVisual, ExpandedVisualOver in order to change the colors of the expander.

You can find these approaches realized in the attached project. Please let us know if it satisfies you or not.
We would be glad if we can further assist you.

Regards,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
liu
Top achievements
Rank 1
answered on 06 Dec 2010, 12:04 PM
Appreciate for your help,there's a problem about your project you send to me.When I first run your project,the effect is what I want,but when I change any element of the project,the effect I run again is different.for example,I only change the Stroke of the IndentFirstVerticalLine,make it be "Red",and the effect is just the picture in the attachment.I can't see the line which I turn it to red.

Waiting for your answer,Thanks.
0
liu
Top achievements
Rank 1
answered on 08 Dec 2010, 02:28 AM
Wish your reply,Thanks.
0
Petar Mladenov
Telerik team
answered on 09 Dec 2010, 01:59 PM
Hi liu,

First of all, please excuse our late response.
From the picture you sent us, it looks like the width of the rectangle named "IndentFirstVerticalLine" is not set and therefore it gets a default value 0. On the other hand, the stroke of the IndentFirstVerticalLine doesn`t apply since the stroke of the Rectangle "VerticalLine" overrides it. Please let us know if we are missing something or this info satisfies you. If it doesn`t could you send us your code and we will be able to investigate your issue in depth. Thank you for your cooperation

Regards,
Petar Mladenov
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
TreeView
Asked by
liu
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
liu
Top achievements
Rank 1
Share this question
or