What to do to after fetching from dB is not lost, the characters "_" when you make data in a DataGrid?

After fetching data from dB(MySql) where in the columns names like this - "rabs_iin", "rabs_firstname", etc. from the insertion of this sample in the DataGrid is lost "_" from the column title.
Ie make a selection in getAllRabs returned DataTable and inserts it in the property grid.ItemsSource data from a DataTable.DefaultView, and column names, missing "_".
public class Rabs
{
 public static int getAllRabs()
{
DB DB = new DB();
 MySqlConnection conn = db.connection;

 DataTable table = new DataTable();

 MySqlDataAdapter adapter = new MySqlDataAdapter();

 MySqlCommand command = new MySqlCommand();
 command.CommandText = "SELECT * FROM companies";
 command.Connection = conn;

 adapter.SelectCommand = command;
adapter.Fill(table);

 return table;
}
}
/**************************/
 DataTable rabs = Rabs.getAllRabs();
//grid - DataGrid
 this.grid.ItemsSource = rabs.DefaultView;
April 3rd 20 at 17:35
1 answer
April 3rd 20 at 17:37
It's an ambush with a ContentPresenter.RecognizesAccessKey in columns. You need to override the template:

<Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
 <Setter Property="ContentTemplate">
<Setter methods.Value>
<DataTemplate>
 <TextBlock Text="{TemplateBinding Content}" HorizontalAlignment="Center"/>
</DataTemplate>
</Setter methods.Value>
</Setter>
</Style>


Or you could nakostylyat replace "_" with "__" in the AutoGeneratingColumn event.

Find more questions by tags WPFC#