wpf - Setting AlternatingRowBackground for DataGrid with Templated DataGridRow -
i need have datagrid black , dark gray rows. default have gray rectangle in left of each row (marked red in screenshot) don't need. remove have use template datagridrow. problem alternatingrowbackground wouldn't work in case, though tried set background="transparent" border , datagridcellspresenter. found example visualstates code seems heavy. there neat way fix it?
<style targettype="{x:type datagridrow}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type datagridrow}"> <border> <datagridcellspresenter/> </border> </controltemplate> </setter.value> </setter> </style> <style targettype="{x:type datagrid}"> <setter property="background" value="black" /> <setter property="foreground" value="white" /> <setter property="rowbackground" value="black" /> <setter property="alternatingrowbackground" value="darkgray" /> </style>
the gray rectangle called row header. default datagrid turns on row , column header. turn off row header setting
headersvisibility=column
so, don't need template done.
Comments
Post a Comment