c# - .NET4.5 Binding a Combobox to a Dictionary Issues. WPF -



c# - .NET4.5 Binding a Combobox to a Dictionary Issues. WPF -

i'm maintaining internal wpf app has combobox bound dictionary property in viewmodel. app written in vs2010 targeting .net4.0 , worked fine.

user machines auto updating .net4.5 & particular combobox not displaying values in ui @ runtime. binding dictionary in app. i've scoured output window in vs2013 there's no apparent binding errors etc. there method populates dictionary & populated correctly & i've implemented inpc. there difference in way .net4.5 binds dictionaries?

xaml:

<combobox itemssource="{binding path=modelarticletypecodetochangetitlemap, mode=twoway, updatesourcetrigger=propertychanged}" converter={staticresource invertboolconverter}}" issynchronizedwithcurrentitem="true" displaymemberpath="value" selectedvaluepath="key" selectedvalue="{binding modelselectedarticletypecode}" text="{binding modelenteredtitle}" />

viewmodel property:

private dictionary<string, string> _modelarticletypecodetotitlemapfilteredbycategory = modelarticletypecodetotitlemap; public dictionary<string, string> modelarticletypecodetotitlemapfilteredbycategory { { homecoming _modelarticletypecodetochangetitlemap; } set { _modelarticletypecodetochangetitlemap = value; onpropertychanged("modelarticletypecodetochangetitlemap"); } }

ok, issue due implementation of inotifypropertychanged not working static property. wrote static version of propertychanged event , raised event in property setter:

// inotifypropertychanged event static properties! public static event eventhandler<propertychangedeventargs> staticpropertychanged; private static void notifystaticpropertychanged(string propertyname) { if (staticpropertychanged != null) { staticpropertychanged(null, new propertychangedeventargs(propertyname)); } }

property:

private dictionary<string, string> _modelarticletypecodetotitlemapfilteredbycategory = modelarticletypecodetotitlemap; public dictionary<string, string> modelarticletypecodetotitlemapfilteredbycategory { { homecoming _modelarticletypecodetochangetitlemap; } set { _modelarticletypecodetochangetitlemap = value; notifystaticpropertychanged("modelarticletypecodetochangetitlemap"); } }

c# wpf mvvm dictionary combobox

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -