Articles in categories

Articles

DataGrid Cell padding

Set cell padding for the WPF DataGrid:

<!--Set DataGrid Cell padding -->
<Style TargetType="{x:Type DataGridCell}">
	<Setter Property="Padding"
		    Value="4" />
	<Setter Property="Template">
		<Setter.Value>
			<ControlTemplate TargetType="{x:Type DataGridCell}">
				<Border Padding="{TemplateBinding Padding}"
					    BorderBrush="{TemplateBinding BorderBrush}"
					    BorderThickness="{TemplateBinding BorderThickness}"
					    Background="{TemplateBinding Background}"
					    SnapsToDevicePixels="True">
					<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
				</Border>
			</ControlTemplate>
		</Setter.Value>
	</Setter>
</Style>