c# - How can you programatically bind a Double to a WidthProperty? -


can double or int bound widthproperty of element such button or border?

i have not seem work. maybe it's not value property binding needs.

double changednum = 3; double mywidth = 100 * changednum; border1.setbinding(widthproperty, new binding("value") { source = mywidth }); 

update

i have posted answer question. goal bind existing slider value , multiply or divide double. have value set binding object's widthproperty. solution below.

you can't bind local variable.

instead, need bind property of object:

someobject.someproperty = 42; new binding("someproperty", someobject) 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -