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,
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
Dispatcher.BeginInvoke(ew Action (() =>
{
//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?