Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1190
XamDataGrid LoadCustomizations auto generated fields
posted

I am using the XamDataGrid and letting it auto generate fields based on my objects.  I call SaveCustomizations on exit and then was calling LoadCustomizations on startup.  I found that the Load call wasn't working (as it didn't load the saved column order and such).  So i figured it was because the FieldLayout wasn't generated yet so i handled the FieldLayoutInitialized event and called it there, still no luck.  Then i noticed the generated field layouts have a GUID name and thought the names must not be matching so i named the FieldLayout in the Initialized handler, still no luck.  So then I handled the loaded event and tried calling it from there, still no luck.  Finally instead of making the direct call to LoadCustomizations in the loaded event i put it on the dispatcher with priority ContextIdle.  And after all of that it seems to work.  I don't see this documented so i am thinking I am doing something wrong.

Here is what I had to do to get it to work

Handle FieldLayoutInitialized and give new FieldLayout a key other than the GUID one

Handle LoadedEvent and dispatch LoadCustomizations call back to myself.