0

I have been searching for an answer to this question, but always find the reversed of what I am looking for.

like this Question: WPF Attached Property Data Binding with following answer:

IsChecked="{Binding Path=(local:Attached.Test), Mode=TwoWay, RelativeSource={RelativeSource Self}}"

But I would like to perform this kind of Binding in code-behind:

<Grid local:MyGridHelper.GridWidth = {Binding Elementname=XY, Path=ActualWidth} />

In code, setting a value for the attached Property is usually easy: MyGridHelper.SetGridWidth(mygrid, value). But how do I get a Binding into this instaed of just a value?

user947737
  • 326
  • 2
  • 11
  • 1
    As usual: `mygrid.SetBinding(MyGridHelper.GridWidthProperty, new Binding { ... });` – Clemens Dec 20 '20 at 13:57
  • Tried that, Callback never fires... (Well yes ist does - was trying whith a Binding on a ColumnDefinition ActualWidth - very buggy) - THANKS! – user947737 Dec 20 '20 at 14:36

0 Answers0