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?