c# - get user input from comboBox and bind to two variables from different classes -


so started wpf few months ago , want user input combobox , bind 2 variables such when selecteditem changes, 2 variables reflect change.

the error facing this:

system.windows.data warning: 40 : bindingexpression path error: '_institution' property not found on 'object' ''objectdataprovider' (hashcode=22018304)'. bindingexpression:path=_institution; dataitem='objectdataprovider' (hashcode=22018304); target element 'combobox' (name='institutioncb'); target property 'selecteditem' (type 'object')

and have no idea says.

<windows.resources>     <objectdataprovider x:key="institutiondata" methodname="getvalues"  objecttype="{x:type sys:enum}">         <objectdataprovider.methodparameters>             <x:type typename="local:institutions"/>         </objectdataprovider.methodparameters>     </objectdataprovider>         <objectdataprovider x:key="userinputdata" objecttype="{x:type local:userinputdata}">         <objectdataprovider.methodparameters>             <sys:string>_institution</sys:string>         </objectdataprovider.methodparameters>     </objectdataprovider>     <objectdataprovider x:key="commonservicemodel" objecttype="{x:type local:servicecommonmodel}">         <objectdataprovider.methodparameters>             <sys:string>_institution</sys:string>         </objectdataprovider.methodparameters>     </objectdataprovider>     <local:converter x:key="converter"/> </window.resources>  

converter in code behind:

public class converter : imultivalueconverter {     public object convert(object[] values, type targettype, object parameter, cultureinfo culture)     {         return values.tostring();     }      public object[] convertback(object value, type[] targettypes, object parameter, cultureinfo culture)     {         return new object[] { value, value };     } } 

and combobox:

<combobox x:name="institutioncb" horizontalalignment ="left" verticalalignment="top" height="22" width="51" margin="5,27,0,0" background="white"                    itemssource="{binding source={staticresource institutiondata}}" tag="institution">     <combobox.selecteditem>         <multibinding converter="{staticresource converter}">             <binding source="{staticresource userinputdata}" path="_institution" bindsdirectlytosource="true" mode="onewaytosource"/>             <binding source="{staticresource commonservicemodel}" path="_institution" bindsdirectlytosource="true" mode="onewaytosource"/>         </multibinding>     </combobox.selecteditem> </combobox> 


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -