highlight a Row using Value Converter


below the xaml, intend highlight row, based on column value in column is_deleted.
want utilize same value converter, when user clicks delete button in grid.

the problem value converter never invoked, hence rowbackgound color never changed.

 <sdk:datagrid autogeneratecolumns="false" itemssource="{binding elementname=atp_m_groupdomaindatasource, path=data}" name="atp_m_groupdatagrid" width="auto" height="auto" rowbackground="{binding path=is_deleted, converter={staticresource rowbackgroundcolorconverter} }" >

 

public class rowbackgroundcolorconverter      implements ivalueconverter        public function convert(byval value object, byval targettype system.type, byval parameter object, byval culture system.globalization.cultureinfo) object implements system.windows.data.ivalueconverter.convert          if value.tostring.toupper.trim = "t"              return new solidcolorbrush(colors.orange)          else              return new solidcolorbrush(colors.white)          end if            'if ctype(value, atp_m_group).is_deleted = "t"          '    return new solidcolorbrush(colors.orange)          'else          '    return new solidcolorbrush(colors.white)          'end if      end function        public function convertback(byval value object, byval targettype system.type, byval parameter object, byval culture system.globalization.cultureinfo) object implements system.windows.data.ivalueconverter.convertback          throw new exception("not implemented")      end function


what wrong ?

hi,

hmmm, that's annoying issue. workaround restore and reassign itemssource of datagrid after you update is_deleted force loadingrow event fired again:

list<person> obj = (list<person>)datagrid.itemssource;  int selectedindex = datagrid.selectedindex;  datagrid.itemssource = null;  datagrid.itemssource = obj;  datagrid.selectedindex = selectedindex; 


Silverlight  >  Visual Studio & Silverlight Development Tools



Comments

Popular posts from this blog

SQL server replication error Cannot find the dbo or user defined function........

BIT Version

Admin Permissions