0

I have an Enum:

namespace LibiqCommonStructures
{
    using System;

    public enum ItemStatusType
    {
        NotImplemented,
        New,
        Processed,
        Missing,
        NotUsed,
        Failed
    }
}


<igWPF:XamDataGrid DataSource="{Binding Path=Images}" ActiveDataItem="{Binding SelectedItem}"  MaxHeight="300">
                <igWPF:XamDataGrid.Resources>
                    <Style TargetType="{x:Type igWPF:DataRecordCellArea}" BasedOn="{StaticResource {x:Type igWPF:DataRecordCellArea}}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.ItemStatus}" Value="{x:Static libIq:ItemStatusType.Missing}">
                                <Setter Property="Background" Value="Tomato"></Setter>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </igWPF:XamDataGrid.Resources>
                <igWPF:XamDataGrid.FieldLayoutSettings>
                    <igWPF:FieldLayoutSettings SelectionTypeRecord="Single" AutoGenerateFields="False" AllowDelete="False"/>
                </igWPF:XamDataGrid.FieldLayoutSettings>
                <igWPF:XamDataGrid.FieldSettings >
                    <igWPF:FieldSettings Width="Auto" AllowEdit="False" />
                </igWPF:XamDataGrid.FieldSettings>
                <igWPF:XamDataGrid.FieldLayouts>

I want to change the background color of the row when the enum is ItemStatusType.Missing

i can see missing the in the binding but the color of the row doesn't change. maybe something is wrong with my x:static?

Gilad
  • 6,437
  • 14
  • 61
  • 119

1 Answers1

2

Just put the enum string in the Value. It will work:

       <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Record.DataItem.ItemStatus}" Value="Missing">
             <Setter Property="Background" Value="Tomato"></Setter>
        </DataTrigger>
Nitin
  • 18,344
  • 2
  • 36
  • 53
  • are yo raising PropertyChanged on ItemStatus? – Nitin Jun 05 '14 at 10:49
  • yes i am, as far as i can see this is not the way to use enum in datatrigger http://stackoverflow.com/questions/13917033/datatrigger-on-enum-to-change-image – Gilad Jun 05 '14 at 11:02
  • sometimes it works sometimes not, might be virtualiztion problem? – Gilad Jun 05 '14 at 13:44