C# wpf datagrid 动态加载数据后改变单元格颜色bug wpfdatagridc#cell 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!--DataGridCellStyle--> <Style TargetType="{x:Type DataGridCell}"> <Setter Property="SnapsToDevicePixels" Value="true"/> <Setter Property="BorderBrush" Value="Transparent"/> <Setter Property="Foreground" Value="White"></Setter> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type DataGridCell}"> <Border BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" SnapsToDevicePixels="True"> <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style>重写单元格 模板,再写一个转换类 Converter ,绑定到Background上。 Socket服务器端实时接收数据并返回数据 return与break的疑惑! c# 如何实现自动拍照 ASP.NET 图片缩放占用内存问题 设为默认下载工具 如何获取C# 窗体客户区大小 高手求救C#问题!!! 利用zedgraph控件如何隐藏X轴? 有关在线统计的global.asax(期待你的到来) treeView鼠标经过节点或选中节点的时候都有一个背景颜色,怎么去掉啊?? exception has been thrown by the target of an invocation winform窗体传值问题
<!--DataGridCellStyle-->
<Style TargetType="{x:Type DataGridCell}">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="White"></Setter>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridCell}">
<Border BorderBrush="{TemplateBinding BorderBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" SnapsToDevicePixels="True">
<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter> </Style>重写单元格 模板,再写一个转换类 Converter ,绑定到Background上。