I've been looking at a very strange issue with one of our more complex XamDataGrids, We style it in code depending on the users prefernce. When we change a view either by user using our report builder or restore a previous view (bespoke code) everythgn works well. The only problem is when we open a data grid, we hook off the OnFieldLayoutInitialized event to display the default view. We call exactly the same code as is called via a combo box change event or button press, but when we call it from the OnFieldLayoutInitialized event, the grid never formats the first 8 columns. Exactly the same code called after formate all columns. Their are no exception thrown not even caught ones and we reduced the complexity so it only set the BG colour and same behaviour. Is their anything in the XamDataGrid code a race condition or somethng which could cause this? Their is nothing left in our code which could cause this and I'm running out of places to look.
Thansk
Muumi
Hello Muumi,
I have been looking into this issue and it seems that the FieldLayoutInitialized event actually triggers the built-in functionality which applies the initial Field settings and the code you add seems to take priority and is executed first and afterwards gets overridden by the built-in functionality. So what you can do to overcome it is try executing your code in a lower priority like so:
Dispatcher.BeginInvoke(new Action(() =>
{
// ADD YOUR CODE HERE...
}), System.Windows.Threading.DispatcherPriority.DataBind, null);
Hope this helps. Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support