c# - Advanced templating of DataGrid specific to the data in hand -
let's have object like:
id = 123456789 date = 01.01.2013 currentitems = 20 totalitems = 200 = 25
i create datagrid
styled similar following image:
i know how create control template datagrid
change general cell style, how can create template given data this?
you use converters, multi bindings, triggers or template selectors... or mixture of both
<gridviewcolumn> <gridviewcolumn.celltemplate> <datatemplate> <contentcontrol contenttemplateselector="{staticresource mycelltemplateselector}" /> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn>
here's multiple bindings on item of collection: (i free typing here, not vs sorry if there missed tags etc..) 1 display 20/200:
<gridviewcolumn> <gridviewcolumn.celltemplate> <datatemplate> <border background="{binding myitems.a}, converter={staticresource bluetored}"> <stackpanel orientation="horizontal"> <textblock text="{binding myitems.currentitems}"/> <textblock text="/"/> <textblock text="{binding myitems.totalitems}"/> </stackpanel> </border> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn>
Comments
Post a Comment