背景色は、セルとグリッド線の間に小さなスペースを残します。それを完全に埋めるにはどうすればよいですか。 padding / margin = 0を試してみました。
スクリーンショット:
スタイリングの専門家はいますか?
<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;
回答:
回答№1は2これは簡単です。 BorderThickness
に 0
:
<DataGrid ItemsSource="{Binding}" >
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="Background" Value="Red"/>
<Setter Property="BorderThickness" Value="0" />
</Style>
</DataGrid.CellStyle>
</DataGrid>
次回はなぜ物事がどう見えるかを知りたい彼らは見て、Snoopを試してみる。コントロールとパネル、およびそれらのプロパティ(この場合は、Margin、Padding、またはBorderThicknessのいずれか)を確認して、XAMLから調整する必要があるものを確認します。