c# - Explain why setting DataGridTextColumn.HeaderTemplate affects all columns? -
c# - Explain why setting DataGridTextColumn.HeaderTemplate affects all columns? -
i have datagridtextcolumn.headertemplate
set, reason seemed have affected datagridtextcolumn's?
this affected both id , name columns, seem should impact column set on such startlog, stoplog , notes.
i couldn't set header, forced set textblock.text
property similar effect.
code below:
<datagrid grid.column="1" grid.row="1" grid.columnspan="5" name="shifts" isreadonly="false" autogeneratecolumns="false"> <datagrid.columns> <datagridtextcolumn header="id" binding="{binding id, mode=onetime}" /> <datagridtextcolumn header="name" binding="{binding name, mode=onetime}" /> <datagridtextcolumn header="startlog" binding="{binding startlog}"> <datagridtextcolumn.headertemplate> <datatemplate> /// seems have affected columns <textblock textwrapping="wrap" text="startlog"/> /// text property set, because datagridtextcolumn.header not work </datatemplate> </datagridtextcolumn.headertemplate> </datagridtextcolumn> <datagridtextcolumn header="stoplog" binding="{binding stoplog}"> <datagridtextcolumn.headertemplate> <datatemplate> <textblock textwrapping="wrap" text="stoplog"/> </datatemplate> </datagridtextcolumn.headertemplate> </datagridtextcolumn> <datagridtextcolumn header="notes" binding="{binding notes}"> <datagridtextcolumn.headertemplate> <datatemplate> <textblock textwrapping="wrap" text="notes"/> </datatemplate> </datagridtextcolumn.headertemplate> </datagridtextcolumn> </datagrid.columns> </datagrid>
c# wpf datagrid wpfdatagrid
Comments
Post a Comment