Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ControlTemplate and Binding problem
Message
From
26/12/2009 13:55:31
 
 
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Environment versions
Environment:
C# 3.0
Miscellaneous
Thread ID:
01440313
Message ID:
01440700
Views:
29
>Hi,
>Thank you for this. But - it doesn't work - it displays exactly the behaviour that I am seeing:
>
>Without the ControlTemplate clicking on the ExpanderButton in the TreeViewItem will expand the node in the tree and also fire the accessor on MyDataItem.IsExpanded.
>
>With the ControlTemplate in place then neither happens.....
>
>At least you have a reproducible case - and your test code is far simpler that the real version I'm working on so I'm going to play with that,
>
>Oh and, FWIW, you're using a different ControlTemplate to me (mine is the XP one - yours looks like Vista?)
>
>One other thing I've just noticed: If, with the ControlTemplate in place, you click on the ExpanderButton then the image toggles but the items aren't shown. Conversely, if you use the code behind button the items are shown but the ExpanderButton image doesn't change....
>
>
>Best,
>Viv

Well... that's why I guessed:

>>I don't get what's wrong<g>

Oh... those... I didn't hook those up. Let me take a look at my code and see how it's done.

Edit: On the toggle button:
<ToggleButton IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}" ClickMode="Press" Name="Expander">
BTW I grabbed the template for AERO from ShowMeTheTemplate. Where did you get yours? The above should be the same in both, and seems to be working for me. I was just double clicking to test instead of using the expanders.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform