Thursday, 15 May 2014

binding - WPF Bind TextBox.Text to a property of the item bound to the SelectedItem of a ComboBox -



binding - WPF Bind TextBox.Text to a property of the item bound to the SelectedItem of a ComboBox -

i have combobox itemssource collection of objects of domain model. 1 of properties of object 'amount' how bind 'amount' property of selecteditem of combobox text of texdtbox?

a quick way in xaml utilize binding element name.

<combobox itemssource="{binding mylist}" x:name="combobox"></combobox> <textbox text="{binding elementname=combobox, path=selecteditem.amount}"></textbox>

you set x:name @ combobox , utilize name bind text box.

if utilize mvvm pattern should think binding selected item of combobox viewmodel , bind textbox property of viewmodel.

wpf binding combobox textbox selecteditem

No comments:

Post a Comment