首页 > 其他分享 >dxg:GridControl 单元格关联其他单元格的颜色设定

dxg:GridControl 单元格关联其他单元格的颜色设定

时间:2023-04-03 16:25:04浏览次数:56  
标签:object return true 单元格 dxg null GridControl public

列样式:

<dxg:GridColumn.CellStyle>
<Style TargetType="{x:Type dxg:LightweightCellEditor}">
<Style.Triggers>
<DataTrigger Value="True">
<DataTrigger.Binding>
<MultiBinding Converter="{StaticResource multiValueConverter}">
<Binding Path="RowData.Row.DogID" Converter="{StaticResource HardwareInfoConverter}"/>//对象集合
<Binding Path="RowData.Row.MacAddr" Converter="{StaticResource HardwareInfoConverter}"/>//对象集合
<Binding Path="RowData.Row.FileModified" Converter="{StaticResource ContentForegroundConverter}"/>//颜色值
<Binding Path="RowData.Row.FileInfoLack" Converter="{StaticResource ContentForegroundConverter}"/>
<Binding Path="RowData.Row.FileStandard" Converter="{StaticResource ContentForegroundConverter2}"/>
<Binding Path="RowData.Row.IsRegisteredName" Converter="{StaticResource ContentForegroundConverter2}"/>
<Binding Path="RowData.Row.EqualDogID" Converter="{StaticResource ContentForegroundConverter}"/>
<Binding Path="RowData.Row.EqualMacAddr" Converter="{StaticResource ContentForegroundConverter}"/>
</MultiBinding>
</DataTrigger.Binding>
<Setter Property="Foreground" Value="Red"/>
</DataTrigger>
</Style.Triggers>
</Style>
</dxg:GridColumn.CellStyle>

 

转换器:

public class MultiValueConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
try
{
if (values.Contains("Red"))
{
return true;
}
for (int i = 0; i < 2; i++)
{
var info = values[i] as List<HardwareInfoModel>;
if (info != null)
{
if (info.Find(n => n.IsSame == true) != null)
{
return true;
}
}
}
return false;
}
catch
{
return false;
}
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
return null;
}
}

标签:object,return,true,单元格,dxg,null,GridControl,public
From: https://www.cnblogs.com/liu-blog/p/17283390.html

相关文章