I've got the following model class set as the source of my DataGrid
:
public class AttributesModel
{
public string Field { get; private set; }
[Display(Name = "Sort Order")]
public SortOrder SortBy { get; set; }
[Display(Name = "Group By")]
public string GroupBy { get; set; }
[Display(Name = "Having")]
public string Having { get; set; }
[Display(Name = "Display Order")]
public string DisplayOrder { get; set; }
[Display(Name = "Aggregate By")]
public Aggregate AggregateBy { get; set; }
public enum Aggregate
{
None,
Sum,
Minimum,
Maximum,
Average
}
public enum SortOrder
{
Unsorted,
Ascending,
Descending
}
public AttributesModel(string field)
{
Field = field;
}
}
I'm basically trying to bind the columns in my DataGrid, with the prpoerties above. They all work except for the enums
which are set up for the combo box columns.
I cannot seem to get the comboboxes to bind. This is what I've tried:
<DataGridComboBoxColumn Width="Auto" CanUserResize="False" CanUserReorder="False" CanUserSort="False" IsReadOnly="False" ItemsSource="{Binding ElementName=AttributesWindow, Path=SortOrder}">
<DataGridComboBoxColumn.Header>Order</DataGridComboBoxColumn.Header>
</DataGridComboBoxColumn>