Form
Description
This component represents a windowed form in Blazor using the Gap.Blazor.Form
model. It uses the Telerik Window
component to simulate a WinForms-style form, supporting features like modal behavior, draggable windows, control boxes, MDI containers, and dynamic positioning.
Usage
Properties
Form: Instance of the
Gap.Blazor.Form
model.TelerikWindowRef: Reference to the Telerik
Window
component.Draggable: Boolean indicating whether the form is draggable (disabled for MDI containers).
Start Position Properties:
LeftStartPosition
,TopStartPosition
,StyleStartPosition
,TransformStartPosition
control the initial window placement.
Methods
OnInitialized(): Subscribes to model and component events, initializes file support, and calculates start position styles.
FormClosing(): Invokes the model’s
Close()
method.GetWindowState(): Maps the model’s
WindowState
to Telerik’sWindowState
.ActivateView(): Focuses the window when activated.
Focus(): Focuses the first control using
MainTabOrderService
.GetStartPositionStyles(): Calculates CSS positioning based on
StartPosition
.GetIconImage(): Retrieves the form’s icon image.
GetHeightPX() / GetWidthPX(): Calculates the form’s dimensions including frame adjustments.
BorderStyleToCss(): Converts
FormBorderStyle
to a CSS-compatible border style.
Dynamic Rendering
The component dynamically renders a windowed form based on the Form
model:
WMStyleBase: Applies styles based on the model.
TelerikWindow: Provides the window UI with title, actions, and content.
WindowTitle: Displays the form’s icon and title.
WindowActions: Renders minimize, maximize, and close buttons based on model flags.
WindowContent: Hosts child content and optionally an MDI container.
Styles
Events
Activated
AutoScrollChanged
ControlBoxChange
ActivateView
NotifyModelChanged
Last updated