Xceed Grid for WinForms v4.3 Documentation
WinPanel control

Welcome to Xceed Grid for WinForms v4.3 > Basic Concepts > Editor Controls > WinPanel control

The WinPanel class represents an extensible and themable panel for Windows Forms. It supports both Windows XP and classic Windows themes and can adapt to the current Windows Theme. The WinPanel control can contain any of the Xceed editors as well as any other .NET control. 

Embedding controls

VB.NET
Copy Code
Dim panel As New WinPanel()
Dim text As New WinTextBox()
text.Location = New Point( 10, 10 )    
Dim button As New WinButton( "..." )
button.Size = New Size( text.Height, text.Height )
button.Location = New Point( text.Bounds.Right + 5, 10 )
Dim calendar As New WinCalendar( True, True )
calendar.Location = New Point( 10, text.Bounds.Bottom + 5 )
Dim checkEnableTextBox As New WinCheckBox( "Enable TextBox", CheckState.Checked )
checkEnableTextBox.Location = New Point( calendar.Bounds.Right + 5, button.Bounds.Bottom )
Dim checkEnableButton As New WinCheckBox( "Enable Button", CheckState.Checked )
checkEnableButton.Location = New Point( calendar.Bounds.Right + 5, checkEnableTextBox.Bottom )
panel.Controls.Add( text )
panel.Controls.Add( button )
panel.Controls.Add( calendar )
panel.Controls.Add( checkEnableTextBox )
panel.Controls.Add( checkEnableButton )
panel.Size = New Size( 260, 175 )
panel.Location = New Point( 10, 10 )
Me.Controls.Add( panel )
C#
Copy Code
WinPanel panel = new WinPanel();    
WinTextBox text = new WinTextBox();
text.Location = new Point( 10, 10 );    
WinButton button = new WinButton( "..." );
button.Size = new Size( text.Height, text.Height );
button.Location = new Point( text.Bounds.Right + 5, 10 );
WinCalendar calendar = new WinCalendar( true, true );
calendar.Location = new Point( 10, text.Bounds.Bottom + 5 );
WinCheckBox checkEnableTextBox = new WinCheckBox( "Enable TextBox", CheckState.Checked );
checkEnableTextBox.Location = new Point( calendar.Bounds.Right + 5, button.Bounds.Bottom );
WinCheckBox checkEnableButton = new WinCheckBox( "Enable Button", CheckState.Checked );
checkEnableButton.Location = new Point( calendar.Bounds.Right + 5, checkEnableTextBox.Bottom );
panel.Controls.Add( text );
panel.Controls.Add( button );
panel.Controls.Add( calendar );
panel.Controls.Add( checkEnableTextBox );
panel.Controls.Add( checkEnableButton );
panel.Size = new Size( 260, 175 );
panel.Location = new Point( 10, 10 );
this.Controls.Add( panel );

Ambientness

A property is considered to be ambient when its value has not been explicitly set and is therefore retrieved from its parent. Usually, only properties that affect the visual representation of a control, such as ForeColor, can inherit their values from their parent. 

Changes that are made to the WinPanel control's appearance are, in most cases, also applied to any child controls contained in the panel. For example, if the ForeColor property of the panel is set to Color.Orange, then the foreground color of all child controls (with the exception of the WinTextBox control) will also be Color.Orange.  

The UIStyle property of the WinPanel control will also affect all child controls, including the WinTextBox control. For example, in the image below, the UIStyle property of the WinPanel control has been set to Xceed.UI.UIStyle.WindowsClassic; therefore, any child control whose UIStyle property was not explicitly set will take on the Windows Classic style.  

If the UIStyle property of a child control is explicitly set, then it will preserve its style even if its parent's UIStyle property is modified. For example, in the image below, the UIStyle property of the WinCalendar control was set to Xceed.UI.UIStyle.WindowsXP, while the WinPanel's was set to Xceed.UI.UIStyle.WindowsClassic. As a result, the WinCalendar has the Windows XP style, but the WinPanel and any of its child controls whose UIStyle property is not explicitly set have the Windows Classic style.