I'm trying to create a grid view with 3 columns, these are taken from a struct:
public struct ColorAttribute
{
public Color Color { get; set; }
public string TextValue { get; set; }
public int Count { get; set; }
}
And then I want to build a the table like so:
<ListView ItemsSource="{Binding ColorAttributes}">
<ListView.View>
<GridView>
<GridViewColumn Header="Color" Width="120" DisplayMemberBinding="{Binding Color}"/>
<GridViewColumn Header="Color Name" Width="120" DisplayMemberBinding="{Binding TextValue}" />
<GridViewColumn Header="Count" Width="50" DisplayMemberBinding="{Binding Count}" />
</GridView>
</ListView.View>
</ListView>
The part I'm not sure about though, is that for the first column, I want to just display a little box of the color, but I'm not sure how to bind the DisplayMemberBinding to something else like the foreground. Currently it just shows as the RGB value again.