API Control - bigtlb/WinFormMarkup Wiki

ControlExtensions

public static class ControlExtensions

Summary

Fluent Extensions for Controls

Members

AccessibleDefaultActionDescription

public static TControl AccessibleDefaultActionDescription<TControl>(this TControl control, 
    string defaultActionDescription)
    where TControl : Control

Sets the Control.AccessibleDefaultActionDescription property, and returns a reference to the control.

Parameters

Name Summary
control
defaultActionDescription

See Also

AccessibleDescription

public static TControl AccessibleDescription<TControl>(this TControl control, 
    string accessibleDescription)
    where TControl : Control

Sets the Control.AccessibleDescription property, and returns a reference to the control.

Parameters

Name Summary
control
accessibleDescription

See Also

AccessibleName

public static TControl AccessibleName<TControl>(this TControl control, string accessibleName)
    where TControl : Control

Sets the Control.AccessibleName property, and returns a reference to the control.

Parameters

Name Summary
control
accessibleName

See Also

AccessibleRole

public static TControl AccessibleRole<TControl>(this TControl control, 
    AccessibleRole accessibleRole)
    where TControl : Control

Sets the Control.AccessibleRole property, and returns a reference to the control.

Parameters

Name Summary
control
accessibleRole

See Also

AllowDrop

public static TControl AllowDrop<TControl>(this TControl control, bool allowDrop)
    where TControl : Control

Sets the Control.AllowDrop property, and returns a reference to the control.

Parameters

Name Summary
control
allowDrop

See Also

Anchor

public static TControl Anchor<TControl>(this TControl control, AnchorStyles anchors)
    where TControl : Control

Sets the Control.Anchor property, and returns a reference to the control.

Parameters

Name Summary
control
anchors

See Also

AutoScrollOffset

public static TControl AutoScrollOffset<TControl>(this TControl control, Point offset)
    where TControl : Control

Sets the Control.AutoScrollOffset property, and returns a reference to the control.

Parameters

Name Summary
control
offset

See Also

AutoSize

public static TControl AutoSize<TControl>(this TControl control, bool autoSize)
    where TControl : Control

Sets the Control.AutoSize property, and returns a reference to the control.

Parameters

Name Summary
control
autoSize

See Also

BackColor

public static TControl BackColor<TControl>(this TControl control, Color color)
    where TControl : Control

Sets the Control.BackColor property, and returns a reference to the control.

Parameters

Name Summary
control
color

See Also

BackgroundImage

public static TControl BackgroundImage<TControl>(this TControl control, Image image)
    where TControl : Control

Sets the Control.BackgroundImage property, and returns a reference to the control.

Parameters

Name Summary
control
image

See Also

BackgroundImageLayout

public static TControl BackgroundImageLayout<TControl>(this TControl control, ImageLayout layout)
    where TControl : Control

Sets the Control.BackgroundImageLayout property, and returns a reference to the control.

Parameters

Name Summary
control
layout

See Also

Binding

public static TControl Binding<TSource, TSourceProp, TControl, TTargetProp>(this TControl control, 
    TSource source, Expression<Func<TSource, TSourceProp>> sourceProp, 
    Expression<Func<TControl, TTargetProp>> targetProp, 
    Func<TSourceProp, TTargetProp>? convert = null, 
    Func<TTargetProp, TSourceProp>? convertBack = null)
    where TControl : Control

Sets up a Binding for a Control.DataBindings collection, and returns a reference to the control.

UpdateMode is OnPropertyChanged, formattingEnabled=false

Parameters

Name Summary
control Target of the data binding
source Source of the data binding
sourceProp A lambda expression accessing the source property (path derived through reflection and can beseveral levels deep)
targetProp A lambda expression accessing the direct target property (must be a member accessor).
convert If present, hooks the Binding.Format event.
convertBack If present, hooks the Binding.Parse event.

See Also

Binding

public static TControl Binding<TSource, TSourceProp, TControl>(this TControl control, 
    TSource source, Expression<Func<TSource, TSourceProp>> sourceProp)
    where TControl : Control

Sets up a Binding to the Control.Text property, and returns a reference to the control.

UpdateMode is OnPropertyChanged, formattingEnabled=false

Parameters

Name Summary
control
source Source of the data binding
sourceProp A lambda expression accessing the source property (path derived through reflection and can beseveral levels deep)

See Also

Bounds

public static TControl Bounds<TControl>(this TControl control, params int[] bounds)
    where TControl : Control

Sets the Control.Bounds property, and returns a reference to the control.

Parameters

Name Summary
control
bounds Either 2 values (width, height), ot 2 values (let, top, width, height`).

See Also

Capture

public static TControl Capture<TControl>(this TControl control, bool capture)
    where TControl : Control

Sets the Control.Capture property, and returns a reference to the control.

Parameters

Name Summary
control
capture

See Also

CausesValidation

public static TControl CausesValidation<TControl>(this TControl control, bool causesValidation)
    where TControl : Control

Sets the Control.CausesValidation property, and returns a reference to the control.

Parameters

Name Summary
control
causesValidation

See Also

ChangeUICues

public static TControl ChangeUICues<TControl>(this TControl control, 
    Action<TControl, UICuesEventArgs> action)
    where TControl : Control

Hooks the Control.ChangeUICues event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

Clicked

public static TControl Clicked<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.Click event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

ClientSize

public static TControl ClientSize<TControl>(this TControl control, Size clientSize)
    where TControl : Control

Sets the Control.ClientSize property, and returns a reference to the control.

Parameters

Name Summary
control
clientSize

See Also

ContextMenuStrip

public static TControl ContextMenuStrip<TControl>(this TControl control, 
    ContextMenuStrip contextMenu)
    where TControl : Control

Sets the Control.ContextMenuStrip property, and returns a reference to the control.

Parameters

Name Summary
control
contextMenu

See Also

Controls

public static TControl Controls<TControl>(this TControl control, params Control[] children)
    where TControl : Control

Adds all of the childrento the control, and return the current control.

Any child control added with a DockStyle.Fill will be brought to front.

Parameters

Name Summary
control
children params collection of controls to add.

See Also

Cursor

public static TControl Cursor<TControl>(this TControl control, Cursor cursor)
    where TControl : Control

Sets the Control.Cursor property, and returns a reference to the control.

Parameters

Name Summary
control
cursor

See Also

Dock

public static TControl Dock<TControl>(this TControl control, DockStyle dockPosition)
    where TControl : Control

Sets the Control.Dock property, and returns a reference to the control.

Parameters

Name Summary
control
dockPosition

See Also

DoubleClicked

public static TControl DoubleClicked<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.DoubleClick event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

Enabled

public static TControl Enabled<TControl>(this TControl control, bool enabled)
    where TControl : Control

See Also

Entered

public static TControl Entered<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

Font

public static TControl Font<TControl>(this TControl control, Font font)
    where TControl : Control

See Also

ForeColor

public static TControl ForeColor<TControl>(this TControl control, Color foreColor)
    where TControl : Control

See Also

GiveFeedback

public static TControl GiveFeedback<TControl>(this TControl control, 
    Action<TControl, GiveFeedbackEventArgs> action)
    where TControl : Control

See Also

GotFocus

public static TControl GotFocus<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

Height

public static TControl Height<TControl>(this TControl control, int height)
    where TControl : Control

See Also

ImeMode

public static TControl ImeMode<TControl>(this TControl control, ImeMode mode)
    where TControl : Control

See Also

ImeModeChanged

public static TControl ImeModeChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

IsAccessible

public static TControl IsAccessible<TControl>(this TControl control, bool isAccessible)
    where TControl : Control

See Also

KeyDown

public static TControl KeyDown<TControl>(this TControl control, 
    Action<TControl, KeyEventArgs> action)
    where TControl : Control

See Also

KeyPress

public static TControl KeyPress<TControl>(this TControl control, 
    Action<TControl, KeyPressEventArgs> action)
    where TControl : Control

See Also

KeyUp

public static TControl KeyUp<TControl>(this TControl control, Action<TControl, KeyEventArgs> action)
    where TControl : Control

See Also

Layout

public static TControl Layout<TControl>(this TControl control, 
    Action<TControl, LayoutEventArgs> action)
    where TControl : Control

See Also

Leave

public static TControl Leave<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

Left

public static TControl Left<TControl>(this TControl control, int left)
    where TControl : Control

See Also

Location

public static TControl Location<TControl>(this TControl control, Point location)
    where TControl : Control

See Also

Location

public static TControl Location<TControl>(this TControl control, int left, int top)
    where TControl : Control

See Also

Margin

public static TControl Margin<TControl>(this TControl control, params int[] margin)
    where TControl : Control

Sets the Control.Margin property, and returns a reference to the control.

Parameters

Name Summary
control
margin Variable number of parameters 1 (all), 2 (horizontal, vertical), or 4 (left, top, right, bottom)

See Also

MaximumSize

public static TControl MaximumSize<TControl>(this TControl control, Size size)
    where TControl : Control

See Also

MinimumSize

public static TControl MinimumSize<TControl>(this TControl control, Size size)
    where TControl : Control

See Also

MouseClicked

public static TControl MouseClicked<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

MouseDoubleClicked

public static TControl MouseDoubleClicked<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

MouseDown

public static TControl MouseDown<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

MouseEnter

public static TControl MouseEnter<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

MouseHover

public static TControl MouseHover<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

MouseLeave

public static TControl MouseLeave<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

MouseMove

public static TControl MouseMove<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

MouseUp

public static TControl MouseUp<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

MouseWheel

public static TControl MouseWheel<TControl>(this TControl control, 
    Action<TControl, MouseEventArgs> action)
    where TControl : Control

See Also

Move

public static TControl Move<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

Name

public static TControl Name<TControl>(this TControl control, string name)
    where TControl : Control

See Also

Padding

public static TControl Padding<TControl>(this TControl control, params int[] padding)
    where TControl : Control

Sets the Control.Padding property, and returns a reference to the control.

Parameters

Name Summary
control
padding Variable number of parameters 1 (all), 2 (horizontal, vertical), or 4 (left, top, right, bottom)

See Also

Paint

public static TControl Paint<TControl>(this TControl control, 
    Action<TControl, PaintEventArgs> action)
    where TControl : Control

See Also

Parent

public static TControl Parent<TControl>(this TControl control, Control parent)
    where TControl : Control

See Also

PreviewKeyDown

public static TControl PreviewKeyDown<TControl>(this TControl control, 
    Action<TControl, PreviewKeyDownEventArgs> action)
    where TControl : Control

See Also

QueryAccessibilityHelp

public static TControl QueryAccessibilityHelp<TControl>(this TControl control, 
    Action<TControl, QueryAccessibilityHelpEventArgs> action)
    where TControl : Control

See Also

QueryContinueDrag

public static TControl QueryContinueDrag<TControl>(this TControl control, 
    Action<TControl, QueryContinueDragEventArgs> action)
    where TControl : Control

See Also

Region

public static TControl Region<TControl>(this TControl control, Region region)
    where TControl : Control

See Also

Resize

public static TControl Resize<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

RightToLeft

public static TControl RightToLeft<TControl>(this TControl control, RightToLeft rtl)
    where TControl : Control

See Also

SetAutoSizeChanged

public static TControl SetAutoSizeChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.AutoSizeChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetBackColorChanged

public static TControl SetBackColorChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.BackColorChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetBackgroundImageChanged

public static TControl SetBackgroundImageChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.BackgroundImageChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetBackgroundImageLayoutChanged

public static TControl SetBackgroundImageLayoutChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.BackgroundImageLayoutChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetBindingContextChanged

public static TControl SetBindingContextChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.BindingContextChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetCausesValidationChanged

public static TControl SetCausesValidationChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.CausesValidationChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetClientSizeChanged

public static TControl SetClientSizeChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.ClientSizeChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetContextMenuStripChanged

public static TControl SetContextMenuStripChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

Hooks the Control.ContextMenuStripChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetControlAdded

public static TControl SetControlAdded<TControl>(this TControl control, 
    Action<TControl, ControlEventArgs> action)
    where TControl : Control

Hooks the Control.ControlAdded event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetControlRemoved

public static TControl SetControlRemoved<TControl>(this TControl control, 
    Action<TControl, ControlEventArgs> action)
    where TControl : Control

Hooks the Control.ControlRemoved event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetCursorChanged

public static TControl SetCursorChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.CursorChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetDockChanged

public static TControl SetDockChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

Hooks the Control.DockChanged event to call the provided action, and returns a reference to the control.

Parameters

Name Summary
control
action

See Also

SetDragDrop

public static TControl SetDragDrop<TControl>(this TControl control, 
    Action<TControl, DragEventArgs> action)
    where TControl : Control

See Also

SetDragEnter

public static TControl SetDragEnter<TControl>(this TControl control, 
    Action<TControl, DragEventArgs> action)
    where TControl : Control

See Also

SetDragLeave

public static TControl SetDragLeave<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetDragOver

public static TControl SetDragOver<TControl>(this TControl control, 
    Action<TControl, DragEventArgs> action)
    where TControl : Control

See Also

SetEnabledChanged

public static TControl SetEnabledChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetFontChanged

public static TControl SetFontChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetForeColorChanged

public static TControl SetForeColorChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetHandleCreated

public static TControl SetHandleCreated<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetHandleDestroyed

public static TControl SetHandleDestroyed<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetHelpRequested

public static TControl SetHelpRequested<TControl>(this TControl control, 
    Action<TControl, HelpEventArgs> action)
    where TControl : Control

See Also

SetInvalidated

public static TControl SetInvalidated<TControl>(this TControl control, 
    Action<TControl, InvalidateEventArgs> action)
    where TControl : Control

See Also

SetLocationChanged

public static TControl SetLocationChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetLostFocus

public static TControl SetLostFocus<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetMarginChanged

public static TControl SetMarginChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetMouseCaptureChanged

public static TControl SetMouseCaptureChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

See Also

SetPaddingChanged

public static TControl SetPaddingChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetParentChanged

public static TControl SetParentChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetRegionChanged

public static TControl SetRegionChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetRightToLeftChanged

public static TControl SetRightToLeftChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

See Also

SetSizeChanged

public static TControl SetSizeChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetStyleChanged

public static TControl SetStyleChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetSystemColorsChanged

public static TControl SetSystemColorsChanged<TControl>(this TControl control, 
    Action<TControl> action)
    where TControl : Control

See Also

SetTabIndexChanged

public static TControl SetTabIndexChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetTabStopChanged

public static TControl SetTabStopChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetTextChanged

public static TControl SetTextChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetValidated

public static TControl SetValidated<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

SetVisibleChanged

public static TControl SetVisibleChanged<TControl>(this TControl control, Action<TControl> action)
    where TControl : Control

See Also

Site

public static TControl Site<TControl>(this TControl control, ISite site)
    where TControl : Control

See Also

Size

public static TControl Size<TControl>(this TControl control, Size size)
    where TControl : Control

See Also

TabIndex

public static TControl TabIndex<TControl>(this TControl control, int tabIndex)
    where TControl : Control

See Also

TabStop

public static TControl TabStop<TControl>(this TControl control, bool tabStop)
    where TControl : Control

See Also

Tag

public static TControl Tag<TControl>(this TControl control, object tag)
    where TControl : Control

See Also

Text

public static TControl Text<TControl>(this TControl control, string text)
    where TControl : Control

See Also

ToBack

public static TControl ToBack<TControl>(this TControl control)
    where TControl : Control

Sends the current control to the back of the parent controls collection. If the control has already been assigned to a parent, then this method calls SendToBack() immediately and returns a reference to the control. Otherwise, if hooks the Control.ParentChanged event, and then invokes SendToBack() when the parent is assigned.

NOTE: Thread-safe. Automatically unhooks from event after ParentChanged has fired.

Parameters

Name Summary
control

See Also

ToFront

public static TControl ToFront<TControl>(this TControl control)
    where TControl : Control

Brings the current control to the front of the parent controls collection. If the control has already been assigned to a parent, then this method calls BringToFront() immediately and returns a reference to the control. Otherwise, if hooks the Control.ParentChanged event, and then invokes BringToFront() when the parent is assigned.

NOTE: Thread-safe. Automatically unhooks from event after ParentChanged has fired.

Parameters

Name Summary
control

See Also

Top

public static TControl Top<TControl>(this TControl control, int top)
    where TControl : Control

See Also

UseWaitCursor

public static TControl UseWaitCursor<TControl>(this TControl control, bool useWait)
    where TControl : Control

See Also

Validating

public static TControl Validating<TControl>(this TControl control, 
    Action<TControl, CancelEventArgs> action)
    where TControl : Control

See Also

Visible

public static TControl Visible<TControl>(this TControl control, bool visible)
    where TControl : Control

See Also

Width

public static TControl Width<TControl>(this TControl control, int width)
    where TControl : Control

See Also

WindowTarget

public static TControl WindowTarget<TControl>(this TControl control, IWindowTarget target)
    where TControl : Control

See Also