Monday, 15 June 2015

c# - How could I access checkbox control placed in WPF datagrid columnHeaderStyle as ContentTemplate -



c# - How could I access checkbox control placed in WPF datagrid columnHeaderStyle as ContentTemplate -

i have placed checkbox command in auto-generated wpf datagrid columnheaderstyle shown below:

<datagrid.columnheaderstyle> <style targettype="datagridcolumnheader"> <setter property="contenttemplate"> <setter.value> <datatemplate> <checkbox x:name="headercheckbox" content="{binding}" /> </datatemplate> </setter.value> </setter> </style> </datagrid.columnheaderstyle>

how access checkbox in code behind? there multiple columns in datagrid, how find out (column-wise) checkbox selected or not ? please suggest.

just add together events checked , unchecked , 1 time checked event ll raised

<datagrid.columnheaderstyle> <style targettype="datagridcolumnheader"> <setter property="contenttemplate"> <setter.value> <datatemplate> <checkbox x:name="headercheckbox" content="{binding}" checked="checkboxchanged" unchecked="checkboxchanged"/> </datatemplate> </setter.value> </setter> </style> </datagrid.columnheaderstyle>

c# wpf wpfdatagrid

No comments:

Post a Comment