Is there a good way to replace the +/- buttons on a TreeView HierarchicalDataTemplate doesn't seem to be the right choice, and I don't know how to use a ControlTemplate with a TreeView.
Thanks
Is there a good way to replace the +/- buttons on a TreeView HierarchicalDataTemplate doesn't seem to be the right choice, and I don't know how to use a ControlTemplate with a TreeView.
Thanks
Replacing the +/- in a TreeView
Mike Weerasinghe
Thank you,
That example give me a big idea to do the tree that I want to do.
I have severals doubts and one is:
what is the way to replace +/- by an image or icon
thanks for all
Jeff Sessions
I guess you put an image control in the treeview that loads from a resource:
<!-- SimpleStyles: TreeViewItem -->
<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
<Setter Property="Focusable" Value="False"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid
Width="15"
Height="13"
Background="Transparent">
<!-- Put Your Image Control Here -->
</Grid>
creativeluf
how could I restyle a treeviewItem
DDressel1
Hi,
Could you give an example I think that I don’t know create an style.
Thanks
PD: I'm spanish and my english is very bad, I`m sorry
mattaz
On this web page http://notstatic.com/simplestyles there is a good example of how to set up styles for many different controls.
If you unzip the source code file on there you will find a file called TreeView.xaml that shows how to replace the Template of a TreeView
Rey_S2006
Hi Jordan,
Have you given Microsoft Expression Interactive Designer a shot at this (http://www.microsoft.com/expression) Though we don't allow you to author HierarchicalDataTemplates in the tool, if you only wanted to change the template of a TreeViewItem, we do a good job at this.
Thanks,
Unni
Andrey33
hpdvs2
Once you've done this, call the style you've just created:
<TreeviewItem Style={StaticResource NameOfYourTreeviewItemStyle} />
HTH.
Bye
Nickthegreek
Hi
Searching, I have found an example of styling a treeview.
The example is here:
ms-help://MS.MSSDK.1033/MS.WinFXSDK.1033/cpref26/html/P_System_Web_UI_WebControls_TreeView_CollapseImageUrl.htm
But mi code is like this:
<TreeView Style="{DynamicResource TreeViewStyle1}" Width="308" Height="249" Canvas.Left="2.8421709430404E-14" Canvas.Top="2.8421709430404E-14" x:Name="TreeView" RenderTransformOrigin="0.5,0.5">
<TreeViewItem x:Name="TreeViewItem" RenderTransformOrigin="0.5,0.5" Header="TreeViewItem">
<TreeViewItem x:Name="TreeViewItem2" RenderTransformOrigin="0.5,0.5" Header="TreeViewItem2"/>
<TreeViewItem x:Name="TreeViewItem3" RenderTransformOrigin="0.5,0.5" Header="TreeViewItem3"/>
<TreeViewItem x:Name="TreeViewItem4" RenderTransformOrigin="0.5,0.5" Header="TreeViewItem4"/>
</TreeViewItem>
...........
In this code I want to modify a treeview to change the image ("plus.jpg") of a collapse treeview, like in the example but I don’t know the way to do it.
I need your help,
Thanks