The background color leaves tiny space between the cell & grid lines. How could I make it fill completely? I have tried tried padding/margin = 0.
Screenshot: 
Any styling experts out there?
<DataGrid ItemsSource="{Binding}" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="Red"/>
</Style>
</DataGrid.CellStyle>
</DataGrid>
Data = new Dictionary<int,string>();
for (int i = 0; i < 5; i++)
Data.Add(i, "Text");
DataContext = Data;
This one's easy. Set the BorderThickness to 0:
<DataGrid ItemsSource="{Binding}" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="Red"/>
<Setter Property="BorderThickness" Value="0" />
</Style>
</DataGrid.CellStyle>
</DataGrid>
Next time you wanna find out why things look how they look, give Snoop a try. Check the controls and panels, and their properties (in this case, it could be either Margin, Padding or BorderThickness), to see what you have to tweak from XAML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With