c# - Translate DataGridComboBoxColumn on the fly -


i have got datagridcomboboxcolumn need translate wpflocalizationextension.

i have got static method in view model, provides available values:

public static list<profilesegmenttype> availablesegmenttypes {     {     var availablesegmenttypes = new list<profilesegmenttype>     {       new profilesegmenttype { value = profilesegmenttypeenum.arc },       new profilesegmenttype { value = profilesegmenttypeenum.line },     };     return availablesegmenttypes;   } } 

the profilesegmenttype looks this:

public class profilesegmenttype {   public profilesegmenttypeenum value { get; set; }   public string label   {     { return resources.localization.adummyvalue; }   } } 

my data grid column definition looks this:

<datagridcomboboxcolumn header="..."                         itemssource="{binding source={x:static viewmodels:profilegeometryviewmodel.availablesegmenttypes}}"                         selectedvaluebinding="{binding segmenttype, mode=twoway, updatesourcetrigger=propertychanged}"                         selectedvaluepath="value"                         displaymemberpath="label" /> 

now labels translated (right dummy value). when switch language, cells not updated, of course. how can achieve is, cell contents updated, when switch language? (i tried use value converter, couldn't work way)

with of comments, solve it. had change profilesegmenttype so:

public class profilesegmenttype : inotifypropertychanged {   public profilesegmenttype()   {     localizedictionary.instance.propertychanged += (e, a) =>     {       if (a.propertyname == "culture")         propertychanged(this, new propertychangedeventargs("label"));     };   }   public profilesegmenttypeenum value { get; set; }    public string label   {     { return common.resources.localization.add; }   }    public event propertychangedeventhandler propertychanged = (e, a) => {}; } 

Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -