I recommend an alternative - use a bound datagrid where the items have the two fields you want shown in the grid. For example:
public class DataItem : DependencyObject
{
public static readonly DependencyProperty DisplayTextProperty = DependencyProperty.Register("DisplayText", typeof(string), typeof(DataItem), new PropertyMetadata(default(string)));
public string DisplayText { get { return (string)GetValue(DisplayTextProperty); } set { SetValue(DisplayTextProperty, value); } }
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register("IsSelected", typeof(bool), typeof(DataItem), new PropertyMetadata(default(bool)));
public bool IsSelected { get { return (bool)GetValue(IsSelectedProperty); } set { SetValue(IsSelectedProperty, value); } }
}
Using a DependencyObject ensures the DataGrid maps the properties properly.
Now just create a list of these DataItems and assign the list to the DataGrid's ItemSource
...
List<DataItem> list = new List<DataItem>();
...fill list with items ...
dataGrid.ItemsSource = list;
...
To check through the required ones, just scan the list either using a foreach loop or a LINQ selector.
foreach(DataItem item in list)
{
if (item.IsSelected)
{
... do your stuff here ...
}
}