Class RadRibbonFormBehavior
Provides specialized behavior for RadRibbonForm instances, managing non-client area interaction, composition effects, and integration with RadRibbonBar controls.
Inheritance
Inherited Members
Namespace: Telerik.WinControls.UI
Assembly: Telerik.WinControls.UI.dll
Syntax
public class RadRibbonFormBehavior : RadNonClientUIBaseFormBehavior<RadRibbonBar>
Remarks
RadRibbonFormBehavior extends RadNonClientUIBaseFormBehavior<T> to provide complete management of ribbon form functionality including Window composition effects, form state handling, mouse interaction processing, and seamless integration between the form's non-client area and the hosted ribbon control.
This behavior handles complex scenarios such as MDI child window management, system button interaction, window state changes, and proper composition effect management for both Aero and non-Aero environments. It coordinates between the form's title bar elements and the ribbon bar's caption area to provide a unified Office-style user experience.
The class manages window message processing for mouse events, activation states, size changes, and MDI operations while maintaining proper visual feedback and state synchronization between the form and its hosted ribbon control.
Constructors
RadRibbonFormBehavior()
Initializes a new instance of the RadRibbonFormBehavior class with default settings.
Declaration
public RadRibbonFormBehavior()
RadRibbonFormBehavior(IComponentTreeHandler)
Initializes a new instance of the RadRibbonFormBehavior class with the specified component tree handler.
Declaration
public RadRibbonFormBehavior(IComponentTreeHandler treeHandler)
Parameters
|
IComponentTreeHandler
treeHandler
The IComponentTreeHandler implementation that this behavior will be associated with. |
RadRibbonFormBehavior(IComponentTreeHandler, Boolean)
Initializes a new instance of the RadRibbonFormBehavior class with the specified component tree handler and child item creation handling configuration.
Declaration
public RadRibbonFormBehavior(IComponentTreeHandler treeHandler, bool shouldHandleCreateChildItems)
Parameters
|
IComponentTreeHandler
treeHandler
The IComponentTreeHandler implementation that this behavior will be associated with. |
|
System.Boolean
shouldHandleCreateChildItems
Determines whether this behavior should handle the CreateChildItems call for element hierarchy creation. |
Properties
BorderWidth
Gets the border width thickness for the ribbon form, derived from the form element's border settings.
Declaration
public override Padding BorderWidth { get; }
Property Value
|
System.Windows.Forms.Padding
A System.Windows.Forms.Padding structure representing the thickness of the form's borders on all sides. This value is used for client area calculations and composition effect management. |
Overrides
ClientMargin
Gets the client margin for the form, with special handling for minimized MDI child windows.
Declaration
public override Padding ClientMargin { get; }
Property Value
|
System.Windows.Forms.Padding
A System.Windows.Forms.Padding structure representing the margins between the form's edges and its client area. For minimized MDI children, the top margin is set to the form's height to effectively hide the client area. |
Overrides
RibbonBar
Gets the RadRibbonBar control that is hosted within this form's non-client area.
Declaration
protected virtual RadRibbonBar RibbonBar { get; }
Property Value
|
RadRibbonBar
The RadRibbonBar instance that serves as the primary UI control for this form, providing ribbon functionality and integration with the form's title bar. |
TopCompositionMargin
Gets the top composition margin for DWM (Desktop Window Manager) glass effects, calculating the appropriate height based on window state and ribbon caption size.
Declaration
public override int TopCompositionMargin { get; }
Property Value
|
System.Int32
An integer representing the top margin in pixels that should be extended into the client area for glass composition effects. The value varies based on whether the window is maximized and whether a ribbon control is present. |
Overrides
Methods
AdjustBehaviorForCompositionSate()
Adjusts the behavior configuration based on the current composition state, managing form element visibility, ribbon bar composition settings, and form shape properties.
Declaration
protected override void AdjustBehaviorForCompositionSate()
Overrides
AdjustFormElementForFormState(Nullable<Int32>)
Adjusts the form element configuration based on the specified window state, managing visibility and properties of form elements for different window states.
Declaration
protected override void AdjustFormElementForFormState(int? formState)
Parameters
|
System.Nullable<System.Int32>
formState
The window state constant indicating the new form state (SIZE_MAXIMIZED, SIZE_RESTORED, SIZE_MINIMIZED). |
Overrides
CanHandleWndProc()
Determines whether this behavior can handle window procedure messages based on theming state and MDI configuration.
Declaration
protected override bool CanHandleWndProc()
Returns
|
System.Boolean
False if theming is allowed and the form is an MDI child; otherwise, true. |
Overrides
CreateFormElement()
Creates and returns the form element that will represent the visual hierarchy for the ribbon form.
Declaration
protected override RadElement CreateFormElement()
Returns
|
RadElement
A new instance of RibbonFormElement that will manage the form's visual representation. |
Overrides
DisposeNonClientUIControlImpls()
Performs cleanup of non-client UI control implementations, including disposal of ribbon form-specific menu strips.
Declaration
protected override void DisposeNonClientUIControlImpls()
Overrides
Form_SizeChanged(Object, EventArgs)
Handles form size change events to manage composition effects, window state synchronization, and form region adjustments based on the current window state and composition settings.
Declaration
protected override void Form_SizeChanged(object sender, EventArgs e)
Parameters
|
System.Object
sender
The source of the event, typically the form. |
|
System.EventArgs
e
An System.EventArgs that contains no event data. |
Overrides
InitializeDummyMenuStrip()
Initializes a dummy menu strip for the form if none exists, ensuring proper integration with Windows menu handling.
Declaration
protected override void InitializeDummyMenuStrip()
Overrides
InitializeNonClientUIControl()
Initializes the non-client UI control by locating and configuring the first RadRibbonBar control found in the form's control collection.
Declaration
protected override void InitializeNonClientUIControl()
Overrides
IsApplicationMenu()
Determines whether the current ribbon configuration uses an application menu style that supports traditional menu behavior.
Declaration
protected override bool IsApplicationMenu()
Returns
|
System.Boolean
True if the application menu style is not BackstageView; otherwise, false. |
Overrides
OnWMActivateCore(ref Message)
Handles WM_ACTIVATE messages to manage form activation states and synchronize ribbon control and form element active states for proper visual feedback.
Declaration
protected override void OnWMActivateCore(ref Message m)
Parameters
|
System.Windows.Forms.Message
m
The Windows message containing activation state information. |
Overrides
OnWmMDIActivate(ref Message)
Handles WM_MDIACTIVATE messages for MDI child window activation, managing form active state properties and calling the base window procedure for proper MDI behavior.
Declaration
protected override bool OnWmMDIActivate(ref Message m)
Parameters
|
System.Windows.Forms.Message
m
The Windows message containing MDI activation information. |
Returns
|
System.Boolean
True if the message was handled; otherwise, false. |
Overrides
OnWmNCLeftMouseButtonDown(ref Message)
Handles WM_NCLBUTTONDOWN messages to process non-client area left mouse button down events, determining whether to allow default window behavior or handle custom ribbon interactions.
Declaration
protected override void OnWmNCLeftMouseButtonDown(ref Message m)
Parameters
|
System.Windows.Forms.Message
m
The Windows message containing mouse position and button state information. |
Overrides
OnWmNCLeftMouseButtonUp(ref Message)
Handles WM_NCLBUTTONUP messages to process non-client area left mouse button up events, managing system commands for window operations and application icon interactions.
Declaration
protected override void OnWmNCLeftMouseButtonUp(ref Message m)
Parameters
|
System.Windows.Forms.Message
m
The Windows message containing mouse position and button state information. |
Overrides
UpdateFormForThemingState(Boolean)
Updates the form's configuration for the specified theming state, adjusting composition effects and applying necessary style updates.
Declaration
protected override void UpdateFormForThemingState(bool showAero)
Parameters
|
System.Boolean
showAero
True to enable Aero composition effects; false to disable them. |
Overrides
UpdateMDIButtonsAndCaptionText()
Updates MDI button visibility and caption text synchronization between the form and ribbon control.
Declaration
protected override void UpdateMDIButtonsAndCaptionText()
Overrides
UpdateNCComposition()
Updates the composition settings of the non-client UI control to match the current behavior state.
Declaration
protected override void UpdateNCComposition()