How to understand when grid's customization is loaded?
This method works asynchronously and doesn't return a value, this is also no LayoutLoaded event.
xamDataGrid.LoadCustomizations(...);
a bug?
HI Andy,
The LoacCustomization method executes asynchronously. There is no event fired when the load is completed. Why do you need to know when the load completes?
Sincerely, Matt Developer Support Engineer
HI, I am just following up on this thread. If you need further assistance, please let me know. Sincerely, Matt Developer Support Engineer
Hi Matt, of course I need more assitance here.
I need an event when async loading of grid's layout is complete.
When I load my grid I always restore its layout first. And then I need to add some custom logic, let say I want to add row summaries to the grid. But loading the layout whipes out my summaries.
Here is some psydo code:
xamDataGrid1.LoadCustomizations(layout);
xamDataGrid1.Records.Summaries.Add(....);
.....
few seconds later when lyout is loaded, the summaries are all empty becase there are not in the layout.
THanks.
Hi Andy,
I submitted a feature request for an event to fire after LoadCustomization has completed.
Can you attach your layout? - I'd like to see the customizations that are causing the Summaries to fail.
HI ,
Just following up on this forum thread.
If you need further assistance, plesae let me know.
Sincerely. Matt Developer Support Engineer
Yes, I need that event when layout is loaded added to xamDataGrid.
Othervise I don't know when to add SummaryDefenitions to my grid. I must do if after grid's layout is loaded. And I don't want to save SummaryDefinitions to the layout cos it would be too unflexible.
Why did you implement it to be async? Surely there must be a callback method..
Hi,
Feature Request has been submitted.
I did notice that the FieldLayouts PropertyChange event does fires after a LoadCustomization method is called. You could wire this event up and bypass the logic init using a global variable that you set during a LoadCustomization process. You could key off of a certain property change to load your summary records.
here a code snippet
load = false;
// xamDataGrid1.FieldLayoutInitializing += new EventHandler<Infragistics.Windows.DataPresenter.Events.FieldLayoutInitializingEventArgs>(xamDataGrid1_FieldLayoutInitializing);
xamDataGrid1.FieldLayouts[0].PropertyChanged += new PropertyChangedEventHandler(MainWindow_PropertyChanged);
}
void MainWindow_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
//throw new NotImplementedException();
if (load)
Dispatcher.BeginInvoke(ew Action (() =>
MessageBox.Show(e.PropertyName);
}), null );Sincerely, Matt Developer Support Engineer
HI,
I am just following up on this forum thread.
Please let me know if you need further assistance.
Sincerely MattDeveloper Support Engineer
Place your summary code inside of the Dispatcher after you call your LoadCustomizations
//add your summary data here
}), null
Sincerely, Matt
Matt, thanks for your reply.
But it won't work. Here a sample code:
xamDataGrid1.DataSource = myDataView;
xamDataGrid1.LoadCustomizations();
After these two line of code you will be getting multiple PropertyChanged events for the Fieldayout. And there is no way to say when it was the layout loaded or loaded at all.
In your code sample the message box could popup just because of some data is bound to a DataGrid.
HI , You could use a global variable and have it initialized to false and only turn it on when you call the LoadCustomizations. Then when you can turn it off
Here a code snippet
void MainWindow_PropertyChanged(object sender, PropertyChangedEventArgs e) { //throw new NotImplementedException(); if (load) { Dispatcher.BeginInvoke(new Action(() => { MessageBox.Show(e.PropertyName); }), null); } }
Sincerely,
Matt
The problem is that FieldLayout_PropertyChanged event is also fired multiple times whe I bind data to the grid. So there is still no way to deferentiate between data binding and layout loading events.
Unless there is a special property name which gets changed when layout is loaded. Do you that?