Tuesday, 15 May 2012

wpf - text box with multiple bindings? -


Is there a way to connect the same text box with two things? I want to set up a binding on "OneWay" and the other set "OneWayToSource" Actually I want to add these two text boxes to one (and preferably a bit behind there is no code).

  & lt; Text box text = "{binding path = actionpermator. Value, mode = vanway sosource}" /> & Lt; Text box text = "{binding path = situational value., Value = mod =}"> & gt;    

You can set MultiBinding to set 2 or more Your text box

example can be used by binding example

  & lt; Text box & gt; & Lt; TextBox.Text & gt; & Lt; Multibide string formatting = "{} {0} {1}" & gt; & Lt; Binding Path = "ActionParameter.Value" mode = "OneWayToSource" /> & Lt; Binding Path = "Status Normal Value" mode = "Oneway" /> & Lt; / MultiBinding & gt; & Lt; /TextBox.Text> & Lt; / Text box & gt;   

But depending on what you need to do with 2 properties, you may need to use the IMultiValueConverter for the process of properties.

Example:

  & lt; Text box & gt; & Lt; TextBox.Resources & gt; & Lt; Local: TestConverter x: key = "Mike" /> & Lt; /TextBox.Resources> & Lt; TextBox.Text & gt; & Lt; Multibind converter = "{static resource micron}" & gt; & Lt; Binding Path = "ActionParameter.Value" mode = "OneWayToSource" /> & Lt; Binding Path = "Status Normal Value" mode = "Oneway" /> & Lt; / MultiBinding & gt; & Lt; /TextBox.Text> & Lt; / Text box & gt;    

No comments:

Post a Comment