c# - WpfToolkit DataGrid: Highlight modified rows -
is there way highlight modified rows on datagrid? since grid bound system.data.datatable
figured might able bind colour of each row it's rowstate (example below), doesn't seem work.
any ideas?
xmlns:data="clr-namespace:system.data;assembly=system.data"
<style x:key="datagridrowstyle" targettype="{x:type toolkit:datagridrow}"> <style.triggers> <trigger property="isselected" value="true"> <setter property="background" value="blue" /> </trigger> <datatrigger binding="{binding rowstate}" value="{x:static data:datarowstate.modified}"> <setter property="background" value="lightyellow" /> </datatrigger> </style.triggers> </style>
<datagrid.rowstyle> <style targettype="datagridrow"> <style.triggers> <datatrigger binding="{binding rowstate}" value="{x:static data:datarowstate.modified}"> <setter property="background" value="lightyellow" /> </datatrigger> </style.triggers> </style> </datagrid.rowstyle>
update
after have posted xaml, it's obvious problem not found in xaml. have shortly looked @ msdn datatable-class , can not see mechanism let wpf detect changes of rowstate
-property. therefore, direct binding property not give reliable results.
seems have wrap data items. recommend make viewmodel items , add property says if row has changed change notification (inotifypropertychanged
or dp) , bind property. surely there other alternatives, imo creating vm per item in cases best solution.
Comments
Post a Comment