Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Collapse]Form Layout Managers
    Side Panel
   [Collapse]Layout Manager
    [Expand]Product Information
    [Expand]Getting Started
    [Collapse]Layout Control
      Layout Control
      Layout Hierarchical Structure
      Converting a Regular Layout of Controls to an XtraLayoutControl
      Customizing a Layout In Code
      Using a LayoutControl in Inherited Forms
    [Expand]Data Layout Control
    [Expand]Layout Item
    [Expand]Layout Groups
    [Expand]Tabbed Group
    [Expand]Other Layout Elements
    [Expand]Customization Capabilities
    [Expand]Size and Alignment
     Flow Layout
     Table Layout
     Focus Management
    [Expand]Appearance and Look and Feel
    [Expand]Miscellaneous
    [Expand]Examples
    [Expand]Member Tables
   [Expand]Tabbed MDI Manager
    Tab Control
   [Expand]Wizard Control
    Workspace Manager
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Using a LayoutControl in Inherited Forms

Microsoft Visual Studio provides the Visual Inheritance (VI) feature that allows a developer to design a base form (user control) and then inherit it at design time; extending it by adding new controls and customizing inherited ones. However, VI has some limitations on using composite controls (including the LayoutControl) on inherited forms.

The Layout Control does not support design-time modifications in inherited forms when using Windows Forms Visual Inheritance (VI). Thus, if you are utilizing the Layout Control in inherited forms, it is necessary to consider the following.

  • At design time, do not change the Layout Control layout in a descendant form (add, move or remove layout items).
  • At design time, do not change the control's properties, and its items in the Properties window, in a descendant form.
  • At design time, you should customize the layout of each Layout Control in the form in which it was created. For instance, if a LayoutControl is created in a base form, its layout must only be customized at design time in this form, rather than in derived forms.
  • You can freely customize the Layout Control layout in code, both in base and inherited forms.

To avoid accidental modification of the LayoutControl and its items within inherited forms, you can make these objects private within the base form.

Expanded Example

Assume that you need to create a base form with a LayoutControl used to arrange all controls, and wish to use VI to clone the layout within inherited forms. The layout can be divided into three rectangular regions, as illustrated in the image below.

The A and B regions will be reproduced without modification in all inherited forms, while region C is unique for each inherited form. To meet the VI rules, instead of creating a base form with a single LayoutControl, you should use three layout controls, as outlined below.

  1. Create a base form with two LayoutControls within it. These should represent the A and B regions.
  2. Customize these LayoutControls as required, within the base form.
  3. Create an inherited form using VI and add a new LayoutControl to the form, to represent region C.
  4. Customize this LayoutControl within the inherited form.

With this solution, there is no need to customize the layout of inherited LayoutControls, which allows you to avoid potential problems with VI.

Expanded See Also

How would you rate this topic?​​​​​​​