c# - WPF Binding in execution time -


i have following binding in xaml file:

fill="{binding elementname=cprange1, path=currentcolor}" 

what syntax setting same building in execution time?

it's not entirely clear you're trying achieve. if you're trying set binding on object @ runtime in code behind, should able this:

for given rectangle

<rectangle name="myrect"/> 

in code:

        // property bind (example)....         public solidcolorbrush mycolor { get; set; }         //          // in initialisation method.         mycolor = new solidcolorbrush(colors.blue);          binding mybinding = new binding("mycolor");         myrect.setbinding(rectangle.fillproperty, mybinding); 

in specific case, want set mybinding.elementname, , point mybinding.path @ property on element wish target.

i may have misunderstood goal.

msdn


Comments