I am trying to change the foreground color of items in ListBox depending on their content.

```
<ListBox x:Name="listBox_advList" HorizontalAlignment="Left" Height="277" Margin="10,38,0,0" VerticalAlignment="Top" Width="491">
        <ListBox.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Style.Triggers>
                    <Trigger Property="Content" Value="GIE">
                        <Setter Property="ListBoxItem.Background" Value="LightGreen" />
                    </Trigger>
                    <Trigger Property="Content" Value="Console Admin Tools">
                        <Setter Property="ListBoxItem.Background" Value="Orange" />
                    </Trigger>                               
                </Style.Triggers>
            </Style>
        </ListBox.ItemContainerStyle>
        </ListBox>

```

I would like to change the color of each item to green or orange, if they **match** 'success' or 'failure'.

In other words, is there some kind of -match or -like applying to triggers that I could use, so that I can change the color of the item if it *contains* 'success' or 'failure' ?

I found this article :
<https://www.codeproject.com/Questions/883626/Wpf-Trigger-If-contains-value>
But I don't know how to convert that code to WPF / XAML.

Thanks a lot guys,

Tristan

**EDIT**
Here is the rest of the code, if it helps :

```
$WPF_button_getAdv.add_Click({

# Clear listBox
$WPF_listBox_advList.Items.Clear()
# Test connection
if (Test-Connection $($WPF_textBox_compName.Text) -Count 1 -ErrorAction SilentlyContinue)
    {
    # Get ADV
    $advertisement = Get-WmiObject -Query "SELECT * FROM CCM_Softwaredistribution" -Namespace "root\CCM\Policy\Machine\ActualConfig" -Computer $($WPF_textBox_compName.Text) -Authentication PacketPrivacy -Impersonation Impersonate
    # Sort ADV : Group by ADVID -> Foreach Object in the Group, select LAST element
    $global:sortAdv = $advertisement | Group-Object ADV_AdvertisementID | ForEach-Object { $_.Group | Select-Object -Last 1 }
    # Get Status
    $advStatus = Get-ChildItem -Path "HKLM:\SOFTWARE\Microsoft\SMS\Mobile Client\Software Distribution\Execution History" -Recurse | ForEach-Object { Get-ItemProperty -Path  $_.PsPath }
    foreach ($item in $global:sortAdv)
        {
        foreach ($value in $advStatus)
            {
            if ($value.PSPath -match $item.PKG_PackageID)
                {
                [array]$listBoxInput += "$($value._State)" + " - $($item.PKG_PackageID)" + " - $($item.PKG_Name)"
                }
            }
        }

    [array]$listBoxInput | ForEach-Object {
    $WPF_listBox_advList.AddText($_)
    }

    }
else { $WPF_textBox_compName.Text = 'Ping KO' }

})

```

What I want to do is change the color of each item depending on the value of *$value.\_State*. If it contains SUCCESS, item in the listBox should be green, if it contains FAILURE it should be orange / red... Thanks ! :)