KB Article T121952
Visible to All Users

The use of XPO and server mode data source components on visually inherited controls

1. When the Windows Forms Visual Inheritance is involved, we strongly recommend using the new XPBindingSource component (available starting with version 19.1) for data binding. Refer to our WinForms code example to get started.

The classic XPO data sources (XPCollection, XPView, XPDataView, XPCursor, XPPageSelector) and server mode data source components (XPServerCollectionSource, XPInstantFeedbackSource, LinqServerModeSource, EntityServerModeSource, etc.) can be added to the last descendant only.  Due to the Visual Studio design-time specificities, these components can attempt to use the database connection at design-time when added to a base Form or UserControl. This can cause exceptions or unwanted side effects.

2. Starting with version 14.1.5, classic XPO data sources detect if the current Form or UserControl is not a last descendant and throw a meaningful warning. For backward compatibility, we left a possibility to disable this feature by setting the static DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection property to true. Put the corresponding code before the InitializeComponent method call in the base Form or UserControl class.

C#
using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class MyFormBase : Form { public MyFormBase() { DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection = true; InitializeComponent(); } } }
Visual Basic
Imports System.Windows.Forms Namespace WindowsFormsApplication1 Partial Public Class MyFormBase Inherits Form Public Sub New() DevExpress.Data.Helpers.IsDesignModeHelper.BypassDesignModeAlterationDetection = True InitializeComponent() End Sub End Class End Namespace
Show previous comments (4)
Dennis Garavsky (DevExpress) 10 years ago

    @Renier: This article also covers the XPDataView component and the suggestions above apply to your situation as well. If this does not help, please create a separate ticket and attach your problematic sample there for internal research.

    J J
    Jose Ruiz Dominguis 9 years ago

      I'm getting the same error on a form derived directly from DevExpress.XtraEditors.XtraForm and with a XPServerCollectionSource, an UnitOfWork and a GridControl defined on it. I tried to set BypassDesignModeAlterationDetection  to true, but it doesn't seem to make any difference.
      I'm using DevExpress.v15.2 on Visual Studio Pro 2015 update 1.

      Dennis Garavsky (DevExpress) 9 years ago

        Hello Jose,

        To process your recent post more efficiently, I created a separate ticket on your behalf: T344461. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

        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.