I have a Silverlight 5 application using the treeview from the SDK. Now by using databinding, mvvm, and HierarchicalDataTemplate
I've created lazy loading for each of the items in the treeview. Now the ExpanderButton
is ofcourse only visible if it has items. Is there a way so I can always show this ExpanderButton
. I do know I have to edit the style template for this to work. But I'm not sure what to edit.
Always Show the ExpanderButton for a TreeViewItem. (Possibly with logic added to it. )
<VisualStateGroup x:Name="HasItemsStates">
<VisualState x:Name="HasItems" />
<VisualState x:Name="NoItems">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpanderButton" Storyboard.TargetProperty="Visibility" Duration="0">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
Did the job