Binding to attached properties

Hello, I can't find any sample on how to bind to an attached property programmatically.

Code that I'm trying to run:

Thumb.SetBinding(ButtonRenderer.BackgroundImageProperty, new Binding("ThumbImage", source: model));

Output

[Binding] - 'ThumbImage' property not found on 'Xamarin.Forms.Slider', target property: 'Xamarin.Forms.Button.BackgroundImage'

ThumbImage is an attached property, and model is a Xamarin.Forms.Slider.
ButtonRenderer.BackgroundImageProperty is another attached property, and Thumb is a Xamarin.Forms.Button.

Please ignore the class names.

Code that works:

ButtonRenderer.SetBackgroundImage(Thumb, GetThumbImage(model));

But without the binding...

Using the WPF binding syntax don't seem to work also:

Thumb.SetBinding(ButtonRenderer.BackgroundImageProperty, new Binding("(SliderRenderer.ThumbImage)", source: model));

Output

[Binding] - '(SliderRenderer' property not found on 'Xamarin.Forms.Slider', target property: 'Xamarin.Forms.Button.BackgroundImage'

Using Xamarin.Forms from NuGet, version 1.3.5.6333-pre1.

Sign In or Register to comment.