Code: Select all
<DataGrid
x:Name="MainDataGrid"
Margin="10,4,10,10"
HorizontalAlignment="Stretch"
AutoGenerateColumns="True" >
<DataGrid.Resources>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="Azure"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="SeaGreen"/>
</Style>
</DataGrid.Resources>
</DataGrid>
The class to be populated as columns/rows:
Code: Select all
public class Prospects
{
public string Prospect { get; set; }
public string Company { get; set; }
public string Title { get; set; }
public string Seller { get; set; }
public string Delivered { get; set; }
public string LinkedInConnectionRequest { get; set; }
public string Email_LinkedIn_1 { get; set; }
public string Call { get; set; }
public string Email_LinkedIn_2 { get; set; }
public string Email_LinkedIn_3 { get; set; }
public string Email_LinkedIn_Break_Up { get; set; }
}
and the code to populate the ItemSource:
Code: Select all
private List<Prospects> LoadData()
{
List<Prospects> prospects = new List<Prospects>();
prospects.Add(new Prospects()
{ Prospect = "name",
Company = "company name",
Title = "title",
Seller = "salesperson"
});
<snip>
prospects.Add(new Prospects()
{
Prospect = "another name",
Company = "another company",
Title = "another title",
Seller = "another salesperson"
});
return prospects;
}
and the result:
which presents each column in alphabetical order. I don't think I asked for that, and would very much like to turn it off, but I don't see where I can do that. Is this a feature, bug, or blunder on my part?