WPF Data Binding of Width Property -


i'm trying bind width property of canvas width property of shape instance. shape width should updated when canvas width gets new value

i want in code, without xaml, because create these elements on runtime.

i tried this, didnt work (the code inside of canvas):

binding binding = new binding(); binding.mode = bindingmode.onetime; binding.source = this; binding.path = new propertypath("width"); shape.setbinding(frameworkelement.widthproperty, binding); 

thanks lot help!

ksman

onetime looks wrong. think want use oneway or twoway. check the bindingmodes

edit

since oneway , actualwidth didn't fix problem, should recommend use tool debugging bindings. use snoop because free, there others. debugging wpf without tool can painful.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -