WPF DataGrid-DataGridCheckBoxColumn vs2010 c# .net -


i working in vs2010. have created datagrid bounded observablecollection list;

the class_cmd looks :

 public class class_retrievecommand {     public string cmd { get; set; }     public bool c_r_cmd { get; set; }     public bool s_cmd { get; set; }     public bool c_s_cmd { get; set; } } 

i have 4 delegates pass window, , window needs update list during runtime. during runtime can see string column of grid updated time datagridcheckboxcolumns never updated.

the datagrid -

<datagrid background="transparent" x:name="datagrid_cmd" width="450" maxheight="450" height="auto" itemssource="{binding}" autogeneratecolumns="true"> 

one of delegates updates bool -

 public void updatec_s_cmd(string msg)     {         foreach (class_cmd c in list.toarray())         {             if (c.cmd.equals(msg))                 c.c_s_cmd = true;         }     } 

i don't understand why bool columns not updated.... can please? thanks.

your class class_retrievecommand needs implement inotifypropertychanged interface. otherwise individual rows databound instances of class don't know underlying properties have changed. if change this, should see changes reflected in grid:

public class class_retrievecommand : inotifypropertychanged {     private bool _crcmd;     private bool _cscmd;     private string _cmd;     private bool _scmd;      public string cmd     {         { return _cmd; }         set         {             _cmd = value;             invokepropertychanged(new propertychangedeventargs("cmd"));         }     }      public bool c_r_cmd     {         { return _crcmd; }         set         {             _crcmd = value;             invokepropertychanged(new propertychangedeventargs("c_r_cmd"));         }     }      public bool s_cmd     {         { return _scmd; }         set         {             _scmd = value;             invokepropertychanged(new propertychangedeventargs("s_cmd"));         }     }      public bool c_s_cmd     {         { return _cscmd; }         set         {             _cscmd = value;             invokepropertychanged(new propertychangedeventargs("c_s_cmd"));         }     }      #region inotifypropertychanged members      public event propertychangedeventhandler propertychanged;      #endregion      public void invokepropertychanged(propertychangedeventargs e)     {         propertychangedeventhandler handler = propertychanged;         if (handler != null)         {             handler(this, e);         }     } } 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -