Templated Control databinding to custom properties
Posted
by Dan Wray
on Stack Overflow
See other posts from Stack Overflow
or by Dan Wray
Published on 2010-03-31T20:41:31Z
Indexed on
2010/03/31
20:43 UTC
Read the original article
Hit count: 382
Silverlight
|databinding
Is there some trick that I'm missing here?
I've created a templated control, very simple. One single property on it, and I'd like to databind from the (viewmodel/datacontext of the) page in which it's hosted to a custom property on the control. The property will eventually be a vector type object, defining the position of the control, however in an attempt to get this to work I've tried reducing it to a basic string property.
Each time I'm faced with "Set property 'SimpleGame.Classes.Sprite.Property' threw an exception.".
I can't even catch the exception in a debug session, the set property code is not being executed.
Do I need to use a dependency / attached property or something? I wouldn't have thought so...
© Stack Overflow or respective owner