i have that code in my desktop application that fill the datagrid from mysql database
var mA = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM items", DataHolder.MySqlConnection);
var mT = new System.Data.DataTable();
dataGrid.ItemsSource = mT.DefaultView;
i know how to change the background color for datagrid that already have columns in it but in that case there isn't no columns to bind in the datagrid until the code is executed
This implies that you are using the auto generated columns. You just need to hook
AutoGeneratedColumns, which give you access to the new columns in the event args, which you then can style accordingly (would recommend defining styles in XAML resources somewhere).