Bug Report Q442164
Visible to All Users

SaveLayoutToStream fails when saving a grid in a tab control

created 12 years ago

Hello,

I have a Silverlight application that has a user interface with a tab control (System.Windows.Controls.TabControl), having two tabs with dxgrids in both.

What I want to do is to save the layout of the grids when the application shuts down.

However, the SaveLayoutToStream fails for the grid that is in the tab that is not active. I can imagine that since the grid is not currently visible, it does not have a layout to save per se. The exception that occurs is however, quite weird. See stack trace at the bottom of this message.

Is there a workaround for this, or if not, could the grid throw a "real" exception, and not fail miserably?

System.Reflection.TargetInvocationException occurred

Message=Exception has been thrown by the target of an invocation.

StackTrace:

vid System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)

vid System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

vid System.Delegate.DynamicInvokeImpl(Object[] args)

vid System.Delegate.DynamicInvoke(Object[] args)

vid DevExpress.Xpf.Core.WPFCompatibility.SLRoutedEvent.InvokeClassHandlers(UIElement element, SLRoutedEventArgs eventArgs)

vid DevExpress.Xpf.Core.WPFCompatibility.RoutedEventsHelper.RaiseEvent(RoutedEventsHelper eventsHelper, Object sender, SLRoutedEventArgs e)

vid DevExpress.Xpf.Core.WPFCompatibility.RoutedEventsExtentions.RaiseEvent(DependencyObject element, Object sender, SLRoutedEventArgs e)

vid DevExpress.Xpf.Core.WPFCompatibility.RoutedEventsExtentions.RaiseEvent(DependencyObject element, SLRoutedEventArgs e)

vid DevExpress.Xpf.Core.Serialization.SerializationProvider.RaiseEvent(SLRoutedEventArgs e)

vid DevExpress.Xpf.Core.Serialization.SerializationProvider.OnStartSerializing(DependencyObject dObj)

vid DevExpress.Xpf.Core.Serialization.Native.SerializationProviderWrapper.DevExpress.Utils.Serializing.IXtraSerializable.OnStartSerializing()

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.CallStartSerializing(Object obj)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.RaiseStartSerializing(Object obj)

vid DevExpress.Xpf.Core.Serialization.DXSerializer.DXSerializeHelper.RaiseStartSerializing(Object obj)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObject(Object obj, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializePropertyAsContent(XtraPropertyInfoCollection store, Object obj, PropertyDescriptor prop, OptionsLayoutBase options, XtraSerializableProperty attr, Int32 index)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeProperty(XtraPropertyInfoCollection store, Object obj, SerializablePropertyDescriptorPair pair, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObjectCore(Object obj, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObject(Object obj, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObject(Object obj, OptionsLayoutBase options)

vid DevExpress.Xpf.Core.Serialization.DXSerializer.SerializationStore.DevExpress.Utils.Serializing.Helpers.IXtraSerializable2.Serialize()

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.PerformManualSerialization(Object obj)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObjectCore(Object obj, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObject(Object obj, XtraSerializationFlags parentFlags, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.Helpers.SerializeHelper.SerializeObject(Object obj, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.XtraSerializer.SerializeObject(Object obj, Stream stream, String appName, OptionsLayoutBase options)

vid DevExpress.Utils.Serializing.XtraSerializer.SerializeObject(Object obj, Object path, String appName, OptionsLayoutBase options)

vid DevExpress.Xpf.Core.Serialization.DXSerializer.SerializeCore(DependencyObject root, Object path, String appName, DXOptionsLayout options, AcceptNestedObjects acceptNested)

vid DevExpress.Xpf.Core.Serialization.DXSerializer.SerializeSingleObject(DependencyObject d, Object path, String appName)

vid DevExpress.Xpf.Grid.DataControlBase.SaveLayoutCore(Object path)

vid DevExpress.Xpf.Grid.DataControlBase.SaveLayoutToStream(Stream stream)

vid xxxxxxxxxxx.xxxxxxxx.xxxxxxxxxxxx.SearchView.SaveSettings()

InnerException: System.ArgumentException

Message=Value does not fall within the expected range.

StackTrace:

vid MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

vid MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)

vid MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)

vid System.Windows.UIElement.TransformToVisual(UIElement visual)

vid DevExpress.Xpf.Core.UIElementExtensions.MapPoint(UIElement element, Point p, UIElement destination)

vid DevExpress.Xpf.Core.UIElementExtensions.MapRect(UIElement element, Rect rect, UIElement destination)

vid DevExpress.Xpf.Core.FrameworkElementExtensions.GetBounds(FrameworkElement element, FrameworkElement relativeTo)

vid DevExpress.Xpf.Core.Native.LayoutHelper.GetRelativeElementRect(UIElement element, UIElement parent)

vid DevExpress.Xpf.Core.ColumnChooserBase.GetLocation(Point point)

vid DevExpress.Xpf.Core.ColumnChooserBase.UpdateContainerLocation(Rect rect)

vid DevExpress.Xpf.Core.ColumnChooserBase.ApplyState(IColumnChooserState istate)

vid DevExpress.Xpf.Grid.DataViewBase.CreateColumnChooser()

vid DevExpress.Xpf.Grid.DataViewBase.get_ActualColumnChooser()

vid DevExpress.Xpf.Grid.DataViewBase.OnSerializeStart()

vid DevExpress.Xpf.Grid.DataViewBase.OnSerializeStart(Object sender, SLRoutedEventArgs e)

InnerException:

Answers

created 12 years ago (modified 12 years ago)

Hi,
Thank you for your notification.
I have converted this ticket to a bug report, and you will be automatically notified about our progress with the bug fixing. As a workaround, I advise you use our DXTabControl and set the DestroyContentOnTabSwitching property to true; this approach should work fine.
Please do not hesitate to contact us if you need further assistance.
Thanks

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.