Sunday, 15 June 2014

wpf - DataGridCheckBoxColumn checkbox formatting -


How do I add 1-pixel top-margin to the checkbox in DataGridCheckBoxColumn?

Any help in this regard will be greatly appreciated ....

You can try the following:

  & lt; DataGrade ItemsSource = "{Binding}" & gt; & Lt; DataGrid.Columns & gt; & Lt; DataGridCheckBoxColumn Header = "Checkbox" & gt; & Lt; DataGridCheckBoxColumn.ElementStyle & gt; & Lt; Style & gt; & Lt; Setter Property = "Framework Element. Margin" Value = "0,1,0,0" /> & Lt; Setter Property = "Framework Element. Horizontal Alignment" value = "center" /> & Lt; / Style & gt; & Lt; /DataGridCheckBoxColumn.ElementStyle> & Lt; / DataGridCheckBoxColumn & gt; & Lt; /DataGrid.Columns> & Lt; / Data grid & gt;   

This works, and the exact checkbox gets the margin specified. See the article about ElementStyle property Also, if you enable editing in your DataGrid , you can change the application to apply the appropriate look.

No comments:

Post a Comment