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
125
Is the IsApplyingCustomizations property exposed anywhere?
posted

Hi,

I have an application which saves grid customizations whenever the user adds/removes/moves/resizes columns, changes sort order etc...  I'm listening to the PropertyChanged event on the Field object in order to detect column width changes, and then I'm checking the property name for "LabelWidthResolved".

But I have a problem in that this event is also raised when the grid is applying customizations internally (for example when the data source is set, and the columns are being displayed for the first time).  Calling the SaveCustomizations method while customizations are being applied returns an xml document containing two field layouts with the same key, one of which is incomplete.  If this same xml document is passed to LoadCustomizations, then many of the user's column settings are lost.

So I want to avoid saving customizations while they are being applied, and I've come across the internal IsApplyingCustomizations property on the grid.  But being internal, I need to use reflection to access it which isn't ideal since the property name may change in a future Infragistics version.  I was wondering if this state is exposed anywhere on XamDataGrid control?

Many thanks,

Graham.

  • 34510
    Offline posted

    Hi Graham,

    Accessing that property through reflection is the only way right now.  That property is not publically exposed anywhere.  Couldn't you hold off from calling SaveCustomizations though until the new data source has finished?  For example you can set a flag right before you change the data source which keeps your PropertyChanged code from calling the method.  Then inside FieldLayoutInitialized or maybe even RecordsInViewChanged you can set the flag again to allow SaveCustomziations to be called.  At that point the grid should have finished applying the customizations due to the data source change.

    I recommend submitting the IsApplyCustomizations property as a new product idea for the XamDataGrid.  You can do this here: http://ideas.infragistics.com.