Search code examples
c#wpfdatagridmaterial-designdataadapter

C# datagrid duplicate the columns when I try to get the data from database table


the code to get the database and show it on the datagrid in this image image My Code

datagrid wpf design image My DataGrid WPF

the result image Result

as shown in the image it duplicate the columns ,one with renamed headers and the other one with same headers from database table

I just want those with renamed headers without duplicate ?


Solution

  • Set AutoGenerateColumns to false. You have prepared your columns in xaml so you do not want to code generate them for you