I have a class X there are some data:
private string yyy;
public string YYY
{
get { return yyy; }
set
{
yyy= value;
NotifyPropertyChanged("YYY");
}
}
private string color;
[Browsable(false)]
public string Color
{
get { return color; }
set
{
color = value;
NotifyPropertyChanged("Color");
}
}
I have ObservableCollection that keeps a list of class X
public ObservableCollection<X> xxx{ get; set; }
The list Contracting to DataGrid by binding as follows:
<DataGrid x:Name="XXXX" ItemsSource="{Binding}" AutoGenerateColumns="True">
</DataGrid>
The list is in the DataContext of the DataGrid,
I want the text of the first column in each row will be on color that I have of the class data? I will do converter that change from string to color but how do I define this in xmal?
You can use a
DataGridTemplateColumnThe conversion from string to color is implicit.
I know it is not strict MVVM but I would not lose sleep about having the Color property of type Color.