locked
Behaviours for treeview RRS feed

  • Question

  • Hi! I'm trying to assign behaviours to a TreeView control without luck. The behaviour should change the state of the screen, and it works for other controls like buttons, but not for the TreeView. Is it not possible to assign behaviours to TreeView items, or is some special trick required?

    I'm planing to use the TreeView as a menu with expandable sub-menus. If there is another control which is better to use for this purpose feel free to inform me ;)

    I've included the code which doesn't work:
    <controls:TreeView HorizontalAlignment="Right" ItemContainerStyle="{StaticResource TreeViewItemStyle}">
    	<controls:TreeViewItem Margin="0" Header="Test">
    		<i:Interaction.Triggers>
    			<i:EventTrigger EventName="MouseLeftButtonDown">
    				<pb:ActivateStateAction TargetScreen="TestScreens.Screen_1_1" TargetState="TestState_On"/>
    			</i:EventTrigger>
    		</i:Interaction.Triggers>
    	</controls:TreeViewItem>
    	...
    
    Sunday, January 24, 2010 6:48 PM

Answers

  • I'm guessing you fixed this by now but in case someone else happens across this post, edit the <i:EventTrigger EventName="MouseLeftButtonDown">  line and change to "MouseLeftButtonUp"

    from my basic understanding, the treeview uses the MouseLeftButtonDown event to trigger the expansion of the nodes so it seems to 'hog' (that's a technical term!) the event so your event trigger never gets fired. Took me a while to find this and it's real frustrating.

    Andrew
    Thursday, March 4, 2010 8:47 AM