0

I have treeview in which i want expander to hide/show treeview.But i want expander icon on right side and exapnder header on left side.Like this

enter image description here

This is what i have done

 <Expander Grid.Row="0" FlowDirection="RightToLeft" >
                    <Expander.Header >
                        <StackPanel Orientation="Horizontal" FlowDirection="LeftToRight" >
                            <TextBlock Foreground="White" FontWeight="Bold">Global Setting</TextBlock>
                            <Path Data="{StaticResource IconGlobalNetworking}" Fill="#07B9D3" Margin="5"></Path>

                            <!--<Path Data="{StaticResource IconGlobalNetworking}" Fill="#07B9D3" Margin="5"></Path>-->
                        </StackPanel>                            
                    </Expander.Header>
                    <TreeView  FlowDirection="LeftToRight" BorderThickness="0" Margin="30,0,0,0">
                        <TreeViewItem>
                            <TreeViewItem.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Path Data="{StaticResource IconServerStack}" Fill="#07B9D3" Margin="5"></Path>
                                    <TextBlock Foreground="White" FontWeight="Bold" Margin="5">Managment Server</TextBlock>
                                </StackPanel>
                            </TreeViewItem.Header>
                        </TreeViewItem>
                        <TreeViewItem>
                            <TreeViewItem.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Path Data="{StaticResource IconSalientServer}" Fill="#07B9D3" Margin="5"></Path>
                                    <TextBlock Foreground="White" FontWeight="Bold" Margin="5">License Server</TextBlock>
                                </StackPanel>
                            </TreeViewItem.Header>
                        </TreeViewItem>
                        <TreeViewItem>
                            <TreeViewItem.Header>
                                <StackPanel Orientation="Horizontal">
                                    <Path Data="{StaticResource IconGlobalNetworking}" Fill="#07B9D3" Margin="5"></Path>
                                    <TextBlock Foreground="White" FontWeight="Bold" Margin="5">Web Server</TextBlock>
                                </StackPanel>
                            </TreeViewItem.Header>
                        </TreeViewItem>
                    </TreeView>
                </Expander>

it gives me output like This

enter image description here

i have tried "flowdirection=right" of exapnder but it moves whole header as well as icon to rightside . i just want exapnder icon on right side.how can i achieve this.plase help.

Neelam Prajapati
  • 3,764
  • 3
  • 28
  • 62

1 Answers1

1

You probably need to replace the Template of the expanders, this button is hard-coded into it.

H.B.
  • 166,899
  • 29
  • 327
  • 400
  • sorry i dont understnd.can u explain in little brief – Neelam Prajapati Jul 15 '16 at 12:59
  • @NeelamPrajapati: Read the [documentation for the property](https://msdn.microsoft.com/en-us/library/system.windows.controls.control.template(v=vs.110).aspx) and the [related class](https://msdn.microsoft.com/en-us/library/system.windows.controls.controltemplate(v=vs.110).aspx). You just redefine the internal composition of the control, there are a lot of examples out there. You may also want to locate the default template, then you can just modify that and don't have to do it from scratch. – H.B. Jul 15 '16 at 13:13