Table of Contents

Class Border

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

Draws a border, background, or both around another control.

[ControlCategory("Containers")]
public class Border : UserControl, IBaseObjectWithId, IDisposableObject, IBaseObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
Border
Implements
Derived

Examples

Here is how to declare a Border in UIXML:

<Border Name="border" Margin="16">
  <StackPanel Orientation="Vertical" Margin="5,0,0,0">
    <Label Text="Label inside border" Margin="8" />
    <Button Text="Button inside border" HorizontalAlignment="Left" Margin="8" />
  </StackPanel>
</Border>

Also, a Border can be created from code:

var Border = new Alternet.UI.Border();
Border.BorderColor = Alternet.Drawing.Color.DarkGray;
Border.Background = Alternet.Drawing.Brushes.Khaki;

Remarks

If you want to display a border around your content, you must place the controls within a parent Border element.

Examples of how a Border can look on different platforms:

Constructors

Border()

Initializes a new instance of the Border class.

Border(Control)

Initializes a new instance of the Border class.

Fields

ShowDebugCorners

Gets or sets whether to show debug corners when control is painted.

Properties

AutoPadding

Gets or sets whether Padding is updated when border width or visibility is changed. Default value is True.

Background

Gets or sets the background brush for the control. Usage of this property depends on the control. Not all controls support it.

BorderColor

Gets or sets the border color for the Border control.

BorderWidth

Gets or sets the border width for the Border control.

ControlKind

Returns control identifier.

DefaultBorderWidth

Gets or sets the default border width for the Border control.

HasBorder

Gets or sets a value indicating whether the control has a border.

HasVisibleBorderBottom

Gets whether bottom border is visible.

HasVisibleBorderTop

Gets whether top border is visible.

NormalBorder

Gets or sets individual border side settings in the normal visual state.

UniformBorderCornerRadius

Gets or sets the uniform corner radius for the Border control.

UniformBorderRadiusIsPercent

Gets or sets whether the uniform corner radius for the Border control is specified in percents.

UniformBorderWidth

Gets or sets the uniform border width for the Border control.

Methods

CreateBorderSettings(BorderSettings)

Creates used BorderSettings instance. Override to use have border painting or non-default behavior.

CreateDefaultBorder(Color?)

Creates border filled with default settings.

DefaultPaint(PaintEventArgs)

Default painting method of the UserControl and its descendants.

GetPreferredSize(SizeD)

Retrieves the size of a rectangular area into which a control can be fitted, in device-independent units.

OnlyBottomBorder(double?)

Configures border so only bottom border is visible and other borders are hidden.

OnlyTopBorder(double?)

Configures border so only top border is visible and other borders are hidden.

ResetBorders()

Resets border so it is returned to the initial state as it was specified in the constructor.

SafeBorderWidth(AbstractControl?)

Gets Thickness that represents border widths for the specified control.

SetBorderColors(Color, Color, Color, Color)

Sets colors of the individual border edges.

SetVisibleBorders(bool, bool, bool, bool, double?)

Sets visible borders. Changes border side widths depending on the paramer values.

UpdatePadding()

Updates Padding with border size.