Thank you very much! The code is working. I really appreciate your effort!
But I think this approach doesn't solve my problem. The final code loks like below:
public Page()
{
InitializeComponent();
DataGridTextColumn col1 = new DataGridTextColumn();
DataGridTextColumn col2 = new DataGridTextColumn();
DataGridTextColumn col3 = new DataGridTextColumn();
col1.HeaderStyle = Application.Current.Resources["grid-header"] as Style;
col2.HeaderStyle = Application.Current.Resources["grid-header"] as Style;
col3.HeaderStyle = Application.Current.Resources["grid-header"] as Style;
theDataGrid.Columns.Add(col1);
theDataGrid.Columns.Add(col2);
theDataGrid.Columns.Add(col3);
}
Everything works OK with Generic.xaml and style in App.xaml. But I still can't set up properties of the GridHeader BEFORE or AFTER setting the Column Style. I supposed something like that:
col1.Header.FilterText = .... // in order to take the last column text from db
col1.FilterLostFocus += .... // in order to store the last column text into db
...
col2.Header.FilterText = ...
col2.FilterLostFocus += ....
...
The "business" problem is that the client wants to store in db the width of the column after changing the size, last "sort order" on the column after changing the sort order and finally the last filter text put into the column header (maby there will be
more "needs" in the future ...).
Bartlomiej
Member
68 Points
45 Posts
Re: Custom DataGrid.Header - BUG in RC0.
Sep 30, 2008 10:41 AM | LINK
Thank you very much! The code is working. I really appreciate your effort!
But I think this approach doesn't solve my problem. The final code loks like below:
Everything works OK with Generic.xaml and style in App.xaml. But I still can't set up properties of the GridHeader BEFORE or AFTER setting the Column Style. I supposed something like that:
The "business" problem is that the client wants to store in db the width of the column after changing the size, last "sort order" on the column after changing the sort order and finally the last filter text put into the column header (maby there will be more "needs" in the future ...).
B.