wpf 数据网格中数据的样式

发布于 2024-08-07 01:29:03 字数 169 浏览 3 评论 0原文

我的数据已填充到我的数据网格中。现在,在最后一列中,我有“失衡”和“不平衡”等数据。我希望显示器将所有“不平衡”数据显示为带下划线和红色,而“平衡”数据显示为绿色,没有任何下划线。请注意,存储过程最初会给我所有“out”平衡”记录后跟“不平衡”记录。请帮忙。我对 WPF 世界完全陌生,必须在星期一之前给出解决方案。提前致谢

I have data being populated into my data grid.Now,In the last column I have data like "Out of Balance " and "Inbalance". I want the display to show all "out of balance" data as being underlined and red in clour while the "in Balance" data to be green in colour without any underline.Note that, the stored proc would give me initially all the "out of balance" records followed by "inbalance" records.please help.I am completely new to the world of WPF and have to give a solution by Monday.Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

隔岸观火 2024-08-14 01:29:03

您可以使用 TemplateColumn:

<Controls:DataGrid.Columns>
  <Controls:DataGridTemplateColumn>
    <Controls:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
        <TextBlock Text="{Binding Data1}" Foreground="Red" TextDecorations="Underline"/>
      </DataTemplate>
    </Controls:DataGridTemplateColumn.CellTemplate>
  </Controls:DataGridTemplateColumn>
</Controls:DataGrid.Columns>

You can use a TemplateColumn:

<Controls:DataGrid.Columns>
  <Controls:DataGridTemplateColumn>
    <Controls:DataGridTemplateColumn.CellTemplate>
      <DataTemplate>
        <TextBlock Text="{Binding Data1}" Foreground="Red" TextDecorations="Underline"/>
      </DataTemplate>
    </Controls:DataGridTemplateColumn.CellTemplate>
  </Controls:DataGridTemplateColumn>
</Controls:DataGrid.Columns>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文