I’m getting all learned up about binding in WPF. I’m having a lot of trouble debugging the parse errors in my xaml, though. Can somebody pretty please tell me what’s wrong with this little piece? :
<Border Name='TrackBackground' Margin='0' CornerRadius='2' Grid.Row='1' Grid.Column='1' Background='BlanchedAlmond' BorderThickness='1' Height='{TemplateBinding Height}'> <Canvas Name='PART_Track' Background='DarkSalmon' Grid.Row='1' Grid.Column='1'> <Thumb Name='ThumbKnob' Height='{Binding ElementName=Part_Track, Path=Height, Mode=OneWay}' /> </Canvas> </Border>
It’s the databinding that breaks. I get an InvalidAttributeValue exception for ThumbKnob.Height when I try to run this. I know I must be missing something fundamental. So fill me in, stackers, and my gratitude will be boundless.
Changing the ElementName didn’t help. There must me something else I’m not getting.
I should mention that I’m testing this in Silverlight. The exact message I’m getting out of Internet Explorer is:
XamlParseException: Invalid attribute value for property Height.
This whole thing is inside a ControlTemplate. I’m making a slider control just to teach myself the concepts.
The ElementName property on a Binding is not supported in Silverlight.
You will notice, if you go into the code behind or inspect the Binding object in class explorer, it doesn’t have a property named ElementName.