c# - Binding chain with slider and text box in wpf -
i binding below:
a (in view) <---> b (in view) <----> c (mydata)
binding a-b : 2 way
binding b-c : 1 way
xaml
<slider x:name="slider" minimum="0" maximum="100" value="{binding path=text, elementname=textbox, mode=twoway}"/> <textbox x:name="textbox" text="{binding path=myvalue, mode=oneway}"/> <button x:name="button" content="button" click="button_click"/> code behind:
public int myvalue { { return m_value; } set { m_value = value; notifypropertychanged("myvalue"); } } ... private void button_click(object sender, routedeventargs e) { myvalue = 10; } i expect when click on button, value of text box , slider bar updated. however, nothing happen.
please me solve problem. thank in advance.
what trying wrong in architecture, that's why suggest take @ documentation mvvm
such as: https://www.codeproject.com/articles/819294/wpf-mvvm-step-by-step-basics-to-advance-level
or instead of considering prism there more powerful more approchable , easier such mvvmlight: http://www.dotnetcurry.com/wpf/1037/mvvm-light-wpf-model-view-viewmodel
hope having been useful
Comments
Post a Comment