if ((bool)greenButton.IsChecked)
{
    CurrentColor = Color.FromArgb(0xFF, 0x00, 0xCC, 0x00);
}
else if ((bool)greyButton.IsChecked)
{
    CurrentColor = Color.FromArgb(0xFF, 0x79, 0x79, 0x79);
}

foreach (var item in ItemsList.Items)
{
    if ((grid.Background as SolidColorBrush).Color == CurrentColor)
    {
        selectedItems.Add(item);
    }
}
By Anonymous, 2019-09-13 15:41:19