1
votes

I'm trying to port a Silverlight application to Metro, and have found that within my ControlTemplate setting my binding to {Binding PropertyName, RelativeSource={RelativeSource TemplatedParent}} does not appear to work, however {TemplateBinding PropertyName} does.

Both of these work within my Silverlight application, however I need to use the RelativeSource syntax to allow the usage of Mode=TwoWay.

What do I need to do to use TwoWay bindings inside a ControlTemplate?

1

1 Answers

2
votes

If you are building your own control - you can define template parts and retrieve them by calling GetTemplateChild() in your OnApplyTemplate() override - then just update properties manually instead of relying on bindings. If you are just retemplating existing controls - maybe you could subclass them first or create attached dependency property/behaviors that take care of the binding.