ComponentOne的FlexGrid背景颜色 [英] ComponentOne's FlexGrid Background Color

查看:83
本文介绍了ComponentOne的FlexGrid背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WPF Caliburn.Micro应用程序。我曾经有一个DataGrid,下面是代码的一部分:

I have a WPF Caliburn.Micro application. I used to have there a DataGrid, and here is a part of the code:

<DataGrid x:Name="FirstEntries" Grid.Row="5"
      AutoGenerateColumns="False"
      BaseControls:DataGridExtension.Columns="{Binding FirstEntryGridColumns}"
      CanUserAddRows="False" IsReadOnly="True"
      SelectedItem="{Binding Path=SelectedFirstEntry}">
  <DataGrid.Resources>
      <conv:StatusToBackgroundColorConverter x:Key="StatusToBackgroundColor"/>
  </DataGrid.Resources>
  <DataGrid.ItemContainerStyle>
      <Style TargetType="{x:Type DataGridRow}">
          <Style.Setters>
              <Setter Property="Background" Value="{Binding Path=Status, Converter={StaticResource StatusToBackgroundColor}}"></Setter>
              <Setter Property="cal:Message.Attach" Value="[Event MouseDoubleClick] = [Action OnDoubleClickFirstEntry($dataContext)]"/>
          </Style.Setters>
      </Style>
  </DataGrid.ItemContainerStyle>

您可以看到每一行的背景颜色绑定到状态字段值,并处理双击事件。现在,我正在迁移到ComponentOne的FlexGrid,但我不知道如何在其中实现相同的功能,因为FlexGrid似乎不了解ItemContainerStyle。

You can see that each row's background color is bound to Status field value, and a double-click event is handled. Now I am migrating to ComponentOne's FlexGrid, and I don't know how I can achieve the same there, as FlexGrid doesn't seem to know ItemContainerStyle.

请问帮助我吗?
谢谢。

Could you please help me with this? Thanks.

推荐答案

C1由于性能原因,FlexGrid有点 WinFormsy的事情,并且没有利用DependencyProperties,或样式/模板,因此您不能使用数据触发器来设置行背景或为所需的事件设置命令。他们的建议是使用Cell的mouseclick事件以代码形式处理所有事件。

C1 FlexGrid does things a little "WinFormsy" for performance reasons and doesn't utilize DependencyProperties, or styles/templates, so you cannot use data triggers to set the row background or set a command to an event like you desire. Their suggestion is to use the Cell's mouseclick events to handle it all in code.

如果可能的话,我的建议是回到WPF 4.0的DataGrid并绑定转至ICollectionView,以利用其过滤功能。链接了许多Bea Stollnitz的关于操纵集合视图的教程。

My suggestion, if at all possible, is to go back to WPF 4.0's DataGrid and bind to an ICollectionView to utilize it's Filtering function. Linked are many of Bea Stollnitz' tutorials on manipulating collection views.

这篇关于ComponentOne的FlexGrid背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆