can't change the style of line of TreeView

5 posts, 0 answers
  1. liu
    liu avatar
    7 posts
    Member since:
    Jul 2010

    Posted 18 Nov 2010 Link to this post

    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.
  2. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 23 Nov 2010 Link to this post

    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
  3. DevCraft banner
  4. liu
    liu avatar
    7 posts
    Member since:
    Jul 2010

    Posted 06 Dec 2010 Link to this post

    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.
  5. liu
    liu avatar
    7 posts
    Member since:
    Jul 2010

    Posted 07 Dec 2010 Link to this post

    Wish your reply,Thanks.
  6. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 09 Dec 2010 Link to this post

    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
Back to Top
DevCraft banner