how can i correct wpf datagrid column name redundancy in visual studio 2012
c#, linq, sql, wpf
Solution
Prevent the DataGrid from generating columns by setting AutoGenerateColumns property to false.
<DataGrid x:Name="datagrid" AutoGenerateColumns="False"
HorizontalAlignment="Left" Height="232" VerticalAlignment="Top" Width="461">
Problem
``` private void ViewWinLoaded(object sender, RoutedEventArgs e) { var stud = from s in data.Students select s; Student[] st=stud.ToArray<Student>(); datagrid.ItemsSource = st; } ``` the above one is my C# code. ``` <DataGrid x:Name="datagrid" HorizontalAlignment="Left" Height="232" VerticalAlignment="Top" Width="461"> <DataGrid.Columns> <DataGridTextColumn Binding="{Binding Path=StudentID}" ClipboardContentBinding="{x:Null}" Header="StudentID"/> <DataGridTextColumn Binding="{Binding Path=FirstName}" ClipboardContentBinding="{x:Null}" Header="First Name"/> <DataGridTextColumn Binding="{Binding Path=LastName}" ClipboardContentBinding="{x:Null}" Header="Last Name"/> <DataGridTextColumn Binding="{Binding Path=Gender}" ClipboardContentBinding="{x:Null}" Header="Gender"/> <DataGridTextColumn Binding="{Binding Path=GPA}" ClipboardContentBinding="{x:Null}" Header="GPA"/> </DataGrid.Columns> </DataGrid> ``` what I am trying to achive is to use my own column name, not the column name in the dB. But when i run the code, it displays my custom column and the column name from the db at the same time(cascaded name)