c# - Empty first value on two comboboxes updating one another -
fairly new c# , xaml have patience! have 2 comboboxes, values shown in each dependent on 1 another. used displaymemberpath , selectedmemberpath so:
<combobox selectedindex="-1" x:name="siteloccombo" selectedvaluepath="generalarea" displaymemberpath="station" itemsource="{binding}"/> <combobox selectedindex="-1" x:name="sitecodecombo" selectedvaluepath="station" displaymemberpath="generalarea" itemsource="{binding}"/> to first value in comboboxes added property issynchronizedwithcurrentitem=true comboboxes not update each other
if want second combo track first combo's selected value...
<combobox selectedindex="-1" x:name="siteloccombo" selectedvaluepath="generalarea" displaymemberpath="station" itemsource="{binding}"/> <combobox selectedindex="-1" x:name="sitecodecombo" selectedvaluepath="station" displaymemberpath="generalarea" itemsource="{binding}" selectedvalue="{binding elementname=siteloccombo, path=selectedvalue}" /> or alternatively, can bind selectedindex, or selecteditem, etc in same way. works case both binding same itemssource, otherwise you'll need converter or property in viewmodel.
Comments
Post a Comment