C# WPF DataGrid.RowStyle set column style -
is possible affect style/behaviorto specified column in specified row in wpf c#?
right have this:
<datatrigger binding="{binding path=status}" value="2"> <setter property="grid.column" value="0"/> <setter property="isenabled" value="false" /> </datatrigger>
the problem right is, entire row disabled. first column disabled in circumstances.
this column, disable:
<datagridtemplatecolumn header="details" width="100"> <datagridtemplatecolumn.celltemplate> <datatemplate> <button click="showdetails">details</button> </datatemplate> </datagridtemplatecolumn.celltemplate> </datagridtemplatecolumn>
this works (disabling 2nd column "y" if value of "x" 3):
<datagrid itemssource="{binding items}" autogeneratecolumns="false"> <datagrid.columns> <datagridtextcolumn header="x" binding="{binding x}"/> <datagridtextcolumn header="y" binding="{binding y}"> <datagridtextcolumn.cellstyle> <style targettype="datagridcell"> <style.triggers> <datatrigger binding="{binding x}" value="3"> <setter property="isenabled" value="false"/> </datatrigger> </style.triggers> </style> </datagridtextcolumn.cellstyle> </datagridtextcolumn> </datagrid.columns> </datagrid>
Comments
Post a Comment