CoreSuite.ControlContainer
1.0.0
See the version list below for details.
dotnet add package CoreSuite.ControlContainer --version 1.0.0
NuGet\Install-Package CoreSuite.ControlContainer -Version 1.0.0
<PackageReference Include="CoreSuite.ControlContainer" Version="1.0.0" />
<PackageVersion Include="CoreSuite.ControlContainer" Version="1.0.0" />
<PackageReference Include="CoreSuite.ControlContainer" />
paket add CoreSuite.ControlContainer --version 1.0.0
#r "nuget: CoreSuite.ControlContainer, 1.0.0"
#:package CoreSuite.ControlContainer@1.0.0
#addin nuget:?package=CoreSuite.ControlContainer&version=1.0.0
#tool nuget:?package=CoreSuite.ControlContainer&version=1.0.0
CoreSuite ControlContainer
CoreSuite.ControlContainer is a reusable .NET 8 Windows Forms component that displays any control inside a floating drop-down window anchored to another control.
It handles positioning, screen boundaries, focus, outside clicks, the Escape key and the opening and closing lifecycle.
Features
- Hosts any Windows Forms
Control. - Anchors the drop-down to a button, text box or another control.
- Keeps the drop-down inside the current screen's working area.
- Closes on outside clicks, Escape or movement of the host's parent.
- Supports a custom border color.
- Exposes opening, opened, closing, closed and state events.
Requirements
- .NET 8
- Windows Forms (
net8.0-windows)
Installation
dotnet add package CoreSuite.ControlContainer
Basic usage
Public Class MainForm
Private ReadOnly DropDownContent As New MonthCalendar()
Private ReadOnly DateDropDown As New ControlContainer()
Public Sub New()
InitializeComponent()
DateDropDown.HostControl = BtnChooseDate
DateDropDown.HostedControl = DropDownContent
DateDropDown.DropDownBorderColor = Color.DodgerBlue
AddHandler DropDownContent.DateSelected, AddressOf DropDownContent_DateSelected
End Sub
Private Sub DropDownContent_DateSelected(Sender As Object, E As DateRangeEventArgs)
TxtDate.Text = E.Start.ToShortDateString()
DateDropDown.CloseDropDown()
End Sub
End Class
With DropDownEnabled = True, clicking HostControl opens the container. It can also be controlled manually:
If DateDropDown.CanDrop Then DateDropDown.ShowDropDown()
DateDropDown.CloseDropDown()
Properties
| Property | Type | Default | Description |
|---|---|---|---|
HostControl |
Control |
Nothing |
Anchor and automatic click trigger. |
HostedControl |
Control |
Nothing |
Control shown in the floating window. |
DropDownEnabled |
Boolean |
True |
Enables opening when the host is clicked. |
DropDownBorderColor |
Color |
SystemColors.HotTrack |
Border color. |
CanDrop |
Boolean |
Read-only | Indicates whether opening is currently allowed. |
DropState |
ControlContainerDropDownState |
Read-only | Current lifecycle state. |
Methods
| Method | Description |
|---|---|
ShowDropDown() |
Opens the drop-down and adjusts it to the screen. |
CloseDropDown() |
Closes it when open. |
ShowDropDown() requires both HostControl and HostedControl.
Events
| Event | Raised when |
|---|---|
Dropping |
Opening begins. |
Dropped |
Opening completes. |
Closing |
Closing begins. |
Closed |
Closing completes. |
DropStateChanged |
The state changes. |
The ControlContainerDropDownState values are Closed, Closing, Dropping and Dropped.
Notes
- Drop-down size follows
HostedControl. - The hosted control moves into the internal floating window while displayed.
- UI operations should run on the Windows Forms UI thread.
License
MIT License.
Repository
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
net8.0-windows7.0
- No dependencies.
NuGet packages (4)
Showing the top 4 NuGet packages that depend on CoreSuite.ControlContainer:
| Package | Downloads |
|---|---|
|
CoreSuite.CMessageBox
A customizable Windows Forms message box with multiple message types, exception details and optional exception reporting by email. |
|
|
CoreSuite.DateTimeBox
Culture-aware WinForms date and time input control with masked entry, a combined calendar and time dropdown, and designer support. |
|
|
CoreSuite.DateBox
A culture-aware Windows Forms date input control with masking, validation and a drop-down calendar. |
|
|
CoreSuite.TimeBox
A culture-aware Windows Forms time input control with masking, validation and a drop-down time selector. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Initial release of the ControlContainer component.