Show / Hide Table of Contents

Class Control

Represents the base class for UI elements that use a ControlTemplate to define their appearance.

Inheritance
System.Object
DependencyObject
UIElement
FrameworkElement
Control
AutoCompleteBox
Calendar
ContentControl
DataField
DataForm
DataGrid
DataGridRow
DataGridRowGroupHeader
DataPager
Axis
AxisLabel
Chart
DataPoint
DefinitionSeries
Series
TreeMap
DatePicker
DescriptionViewer
GlobalCalendar
GridSplitter
ItemsControl
PasswordBox
Picker
CalendarItem
GlobalCalendarItem
RangeBase
Thumb
RichTextBox
Separator
Spinner
TextBox
TimePickerPopup
UpDownBase
UserControl
ValidationSummary
Inherited Members
FrameworkElement.LayoutUpdated
FrameworkElement.SizeChanged
FrameworkElement.ResourceLookupMode
FrameworkElement.StyleProperty
FrameworkElement.Style
FrameworkElement.DefaultStyleKeyProperty
FrameworkElement.DefaultStyleKey
FrameworkElement.OverridesDefaultStyleProperty
FrameworkElement.OverridesDefaultStyle
FrameworkElement.OnVisualParentChanged(DependencyObject)
FrameworkElement.VisualChildrenCount
FrameworkElement.GetVisualChild(Int32)
FrameworkElement.Parent
FrameworkElement.AddLogicalChild(Object)
FrameworkElement.RemoveLogicalChild(Object)
FrameworkElement.LogicalChildren
FrameworkElement.TemplatedParent
FrameworkElement.Resources
FrameworkElement.IsLoaded
FrameworkElement.SetBinding(DependencyProperty, BindingBase)
FrameworkElement.SetBinding(DependencyProperty, Binding)
FrameworkElement.GetBindingExpression(DependencyProperty)
FrameworkElement.Cursor
FrameworkElement.CursorProperty
FrameworkElement.FindName(String)
FrameworkElement.Name
FrameworkElement.NameProperty
FrameworkElement.DataContext
FrameworkElement.DataContextProperty
FrameworkElement.DataContextChanged
FrameworkElement.Triggers
FrameworkElement.FlowDirectionProperty
FrameworkElement.FlowDirection
FrameworkElement.LanguageProperty
FrameworkElement.Language
FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs)
FrameworkElement.Tag
FrameworkElement.TagProperty
FrameworkElement.LoadedEvent
FrameworkElement.Loaded
FrameworkElement.Unloaded
FrameworkElement.BindingValidationError
FrameworkElement.ContextMenuProperty
FrameworkElement.ContextMenu
FrameworkElement.ContextMenuOpening
FrameworkElement.ToolTipProperty
FrameworkElement.ToolTip
FrameworkElement.INTERNAL_OnDetachedFromVisualTree()
FrameworkElement.INTERNAL_OnAttachedToVisualTree()
FrameworkElement.Height
FrameworkElement.HeightProperty
FrameworkElement.Width
FrameworkElement.WidthProperty
FrameworkElement.HorizontalAlignment
FrameworkElement.HorizontalAlignmentProperty
FrameworkElement.VerticalAlignment
FrameworkElement.VerticalAlignmentProperty
FrameworkElement.Margin
FrameworkElement.MarginProperty
FrameworkElement.MinHeight
FrameworkElement.MinHeightProperty
FrameworkElement.MinWidth
FrameworkElement.MinWidthProperty
FrameworkElement.MaxHeight
FrameworkElement.MaxHeightProperty
FrameworkElement.MaxWidth
FrameworkElement.MaxWidthProperty
FrameworkElement.ActualWidthProperty
FrameworkElement.ActualWidth
FrameworkElement.ActualHeightProperty
FrameworkElement.ActualHeight
UIElement.TransformToVisual(UIElement)
UIElement.OnCreateAutomationPeer()
UIElement.RenderSize
UIElement.DesiredSize
UIElement.InvalidateMeasure()
UIElement.InvalidateArrange()
UIElement.Measure(Size)
UIElement.Arrange(Rect)
UIElement.UpdateLayout()
UIElement.DragEnter
UIElement.DragLeave
UIElement.Drop
UIElement.DragOver
UIElement.CacheMode
UIElement.CacheModeProperty
UIElement.Projection
UIElement.ProjectionProperty
UIElement.VisualParent
UIElement.AddVisualChild(UIElement)
UIElement.RemoveVisualChild(UIElement)
UIElement.OnVisualChildrenChanged(DependencyObject, DependencyObject)
UIElement.XamlSourcePath
UIElement.ClipToBounds
UIElement.ClipToBoundsProperty
UIElement.ClipProperty
UIElement.Clip
UIElement.IsEnabledProperty
UIElement.IsEnabled
UIElement.IsEnabledChanged
UIElement.EffectProperty
UIElement.Effect
UIElement.RenderTransformProperty
UIElement.RenderTransform
UIElement.RenderTransformOriginProperty
UIElement.RenderTransformOrigin
UIElement.UseLayoutRounding
UIElement.UseLayoutRoundingProperty
UIElement.Visibility
UIElement.VisibilityProperty
UIElement.IsVisibleProperty
UIElement.IsVisible
UIElement.IsVisibleChanged
UIElement.OpacityProperty
UIElement.Opacity
UIElement.OpacityMaskProperty
UIElement.OpacityMask
UIElement.IsHitTestVisible
UIElement.IsHitTestVisibleProperty
UIElement.AllowDrop
UIElement.AllowDropProperty
UIElement.CaptureMouse()
UIElement.IsMouseCaptured
UIElement.ReleaseMouseCapture()
UIElement.AllowScrollOnTouchMove
UIElement.AllowScrollOnTouchMoveProperty
UIElement.AddHandler(RoutedEvent, Delegate, Boolean)
UIElement.RemoveHandler(RoutedEvent, Delegate)
UIElement.MouseMoveEvent
UIElement.MouseMove
UIElement.OnMouseMove(MouseEventArgs)
UIElement.MouseLeftButtonDownEvent
UIElement.MouseLeftButtonDown
UIElement.OnMouseLeftButtonDown(MouseButtonEventArgs)
UIElement.MouseRightButtonDownEvent
UIElement.MouseRightButtonDown
UIElement.OnMouseRightButtonDown(MouseButtonEventArgs)
UIElement.MouseWheelEvent
UIElement.MouseWheel
UIElement.OnMouseWheel(MouseWheelEventArgs)
UIElement.MouseLeftButtonUpEvent
UIElement.MouseLeftButtonUp
UIElement.OnMouseLeftButtonUp(MouseButtonEventArgs)
UIElement.MouseEnterEvent
UIElement.MouseEnter
UIElement.OnMouseEnter(MouseEventArgs)
UIElement.MouseLeaveEvent
UIElement.MouseLeave
UIElement.OnMouseLeave(MouseEventArgs)
UIElement.TextInputStartEvent
UIElement.TextInputStart
UIElement.OnTextInputStart(TextCompositionEventArgs)
UIElement.TextInputEvent
UIElement.TextInput
UIElement.OnTextInput(TextCompositionEventArgs)
UIElement.TextInputUpdateEvent
UIElement.TextInputUpdate
UIElement.TappedEvent
UIElement.Tapped
UIElement.OnTapped(TappedRoutedEventArgs)
UIElement.MouseRightButtonUpEvent
UIElement.MouseRightButtonUp
UIElement.OnMouseRightButtonUp(MouseButtonEventArgs)
UIElement.KeyDownEvent
UIElement.KeyDown
UIElement.OnKeyDown(KeyEventArgs)
UIElement.KeyUpEvent
UIElement.KeyUp
UIElement.OnKeyUp(KeyEventArgs)
UIElement.GotFocusEvent
UIElement.GotFocus
UIElement.LostFocusEvent
UIElement.LostFocus
UIElement.LostMouseCapture
UIElement.OnLostMouseCapture(MouseEventArgs)
UIElement.INTERNAL_AttachToDomEvents()
UIElement.INTERNAL_DetachFromDomEvents()
DependencyObject.GetValue(DependencyProperty)
DependencyObject.SetCurrentValue(DependencyProperty, Object)
DependencyObject.ReadLocalValue(DependencyProperty)
DependencyObject.SetValue(DependencyProperty, Object)
DependencyObject.SetValue(DependencyPropertyKey, Object)
DependencyObject.CoerceValue(DependencyProperty)
DependencyObject.Dispatcher
DependencyObject.ClearValue(DependencyProperty)
DependencyObject.ClearValue(DependencyPropertyKey)
DependencyObject.CheckAccess()
DependencyObject.GetAnimationBaseValue(DependencyProperty)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: System.Windows.Controls
Assembly: OpenSilver.dll
Syntax
public class Control : FrameworkElement, IControl, IFrameworkElement, IUIElement, IDependencyObject

Constructors

| Improve this Doc View Source

Control()

Represents the base class for UI elements that use a ControlTemplate to define their appearance.

Declaration
public Control()

Fields

| Improve this Doc View Source

BackgroundProperty

Identifies the Background dependency property.

Declaration
public static readonly DependencyProperty BackgroundProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

BorderBrushProperty

Identifies the BorderBrush dependency property.

Declaration
public static readonly DependencyProperty BorderBrushProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

BorderThicknessProperty

Identifies the BorderThickness dependency property.

Declaration
public static readonly DependencyProperty BorderThicknessProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

CharacterSpacingProperty

Identifies the CharacterSpacing dependency property.

Declaration
public static readonly DependencyProperty CharacterSpacingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontFamilyProperty

Identifies the FontFamily dependency property.

Declaration
public static readonly DependencyProperty FontFamilyProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontSizeProperty

Identifies the FontSize dependency property.

Declaration
public static readonly DependencyProperty FontSizeProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontStretchProperty

Identifies the FontStretch dependency property.

Declaration
[NotImplemented]
public static readonly DependencyProperty FontStretchProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontStyleProperty

Identifies the FontStyle dependency property.

Declaration
public static readonly DependencyProperty FontStyleProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

FontWeightProperty

Identifies the FontWeight dependency property.

Declaration
public static readonly DependencyProperty FontWeightProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

ForegroundProperty

Identifies the Foreground dependency property.

Declaration
public static readonly DependencyProperty ForegroundProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

HorizontalContentAlignmentProperty

Identifies the HorizontalContentAlignment dependency property.

Declaration
public static readonly DependencyProperty HorizontalContentAlignmentProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

IsTabStopProperty

Identifies the IsTabStop dependency property.

Declaration
public static readonly DependencyProperty IsTabStopProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

PaddingProperty

Identifies the Padding dependency property.

Declaration
public static readonly DependencyProperty PaddingProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TabIndexProperty

Identifies the TabIndex dependency property.

Declaration
public static readonly DependencyProperty TabIndexProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TabNavigationProperty

Identifies the TabNavigation dependency property.

Declaration
public static readonly DependencyProperty TabNavigationProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TemplateProperty

Identifies the Template dependency property.

Declaration
public static readonly DependencyProperty TemplateProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

TextDecorationsProperty

Identifies the TextDecorations dependency property.

Declaration
public static readonly DependencyProperty TextDecorationsProperty
Field Value
Type Description
DependencyProperty
| Improve this Doc View Source

VerticalContentAlignmentProperty

Identifies the VerticalContentAlignment dependency property.

Declaration
public static readonly DependencyProperty VerticalContentAlignmentProperty
Field Value
Type Description
DependencyProperty

Properties

| Improve this Doc View Source

Background

Gets or sets a brush that provides the background of the control.

Declaration
public Brush Background { get; set; }
Property Value
Type Description
Brush
| Improve this Doc View Source

BorderBrush

Gets or sets a brush that describes the border background of a control.

Declaration
public Brush BorderBrush { get; set; }
Property Value
Type Description
Brush
| Improve this Doc View Source

BorderThickness

Gets or sets the thickness of the border.

Declaration
public Thickness BorderThickness { get; set; }
Property Value
Type Description
Thickness
| Improve this Doc View Source

CharacterSpacing

Gets or sets the distance between characters of text in the control measured in 1000ths of the font size.

Declaration
public int CharacterSpacing { get; set; }
Property Value
Type Description
System.Int32

The distance between characters of text in the control measured in 1000ths of the font size. The default is 0.

| Improve this Doc View Source

EnableBaseControlHandlingOfVisualStates

Derived classes can set this flag to True in their constructor in order to disable the "GoToState" calls of this class related to PointerOver/Pressed/Disabled, and handle them by themselves. An example is the ToggleButton control, which contains states such as "CheckedPressed", "CheckedPointerOver", etc. The default value is false.

Declaration
protected bool EnableBaseControlHandlingOfVisualStates { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

FontFamily

Gets or sets the font used to display text in the control.

Declaration
public FontFamily FontFamily { get; set; }
Property Value
Type Description
FontFamily
| Improve this Doc View Source

FontSize

Gets or sets the size of the text in this control.

Declaration
public double FontSize { get; set; }
Property Value
Type Description
System.Double

The size of the text in the Control. The default is 11 (in pixels).

| Improve this Doc View Source

FontStretch

Gets or sets the degree to which a font is condensed or expanded on the screen.

Declaration
[NotImplemented]
public FontStretch FontStretch { get; set; }
Property Value
Type Description
FontStretch

One of the values that specifies the degree to which a font is condensed or expanded on the screen. The default is Normal.

| Improve this Doc View Source

FontStyle

Gets or sets the style in which the text is rendered.

Declaration
public FontStyle FontStyle { get; set; }
Property Value
Type Description
FontStyle
| Improve this Doc View Source

FontWeight

Gets or sets the thickness of the specified font.

Declaration
public FontWeight FontWeight { get; set; }
Property Value
Type Description
FontWeight
| Improve this Doc View Source

Foreground

Gets or sets a brush that describes the foreground color.

Declaration
public Brush Foreground { get; set; }
Property Value
Type Description
Brush

The brush that paints the foreground of the control. The default value is Black.

| Improve this Doc View Source

HandlesScrolling

Gets a value that indicates whether a control supports scrolling.

Declaration
protected virtual bool HandlesScrolling { get; }
Property Value
Type Description
System.Boolean

true if the control has a ScrollViewer in its style and has a custom keyboard scrolling behavior; otherwise, false.

| Improve this Doc View Source

HorizontalContentAlignment

Gets or sets the horizontal alignment of the control's content.

Declaration
public HorizontalAlignment HorizontalContentAlignment { get; set; }
Property Value
Type Description
HorizontalAlignment
| Improve this Doc View Source

IsTabStop

Gets or sets a value that indicates whether a control is included in tab navigation.

Declaration
public bool IsTabStop { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

Padding

Gets or sets the distance between the border and its child object.

Declaration
public Thickness Padding { get; set; }
Property Value
Type Description
Thickness
| Improve this Doc View Source

TabIndex

Gets or sets a value that determines the order in which elements receive focus when the user navigates through controls by pressing the Tab key. The default value is MaxValue

Declaration
public int TabIndex { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

TabNavigation

Gets or sets a value that modifies how tabbing and TabIndex work for this control.

Declaration
public KeyboardNavigationMode TabNavigation { get; set; }
Property Value
Type Description
KeyboardNavigationMode

A value of the enumeration. The default is Local.

| Improve this Doc View Source

Template

Gets or sets a control template.

Declaration
public ControlTemplate Template { get; set; }
Property Value
Type Description
ControlTemplate
| Improve this Doc View Source

TextDecorations

Gets or sets the text decorations (underline, strikethrough...).

Declaration
public TextDecorationCollection TextDecorations { get; set; }
Property Value
Type Description
TextDecorationCollection
| Improve this Doc View Source

VerticalContentAlignment

Gets or sets the vertical alignment of the control's content.

Declaration
public VerticalAlignment VerticalContentAlignment { get; set; }
Property Value
Type Description
VerticalAlignment

Methods

| Improve this Doc View Source

ApplyTemplate()

Loads the relevant control template so that its parts can be referenced.

Declaration
public bool ApplyTemplate()
Returns
Type Description
System.Boolean

Returns whether the visual tree was rebuilt by this call. true indicates the tree was rebuilt; false indicates that the previous visual tree was retained.

| Improve this Doc View Source

ArrangeOverride(Size)

Provides the behavior for the Arrange pass of Silverlight layout. Classes can override this method to define their own Arrange pass behavior.

Declaration
protected override Size ArrangeOverride(Size finalSize)
Parameters
Type Name Description
Size finalSize

The final area within the parent that this object should use to arrange itself and its children.

Returns
Type Description
Size

The actual size that is used after the element is arranged in layout.

Overrides
FrameworkElement.ArrangeOverride(Size)
| Improve this Doc View Source

CreateDomElement(Object, out Object)

Declaration
public sealed override object CreateDomElement(object parentRef, out object domElementWhereToPlaceChildren)
Parameters
Type Name Description
System.Object parentRef
System.Object domElementWhereToPlaceChildren
Returns
Type Description
System.Object
Overrides
FrameworkElement.CreateDomElement(Object, out Object)
| Improve this Doc View Source

Focus()

Attempts to set the focus on the control.

Declaration
public bool Focus()
Returns
Type Description
System.Boolean

true if focus was set to the control, or focus was already on the control. false if the control is not focusable.

| Improve this Doc View Source

GetTemplateChild(String)

Retrieves the named element in the instantiated ControlTemplate visual tree.

Declaration
protected DependencyObject GetTemplateChild(string childName)
Parameters
Type Name Description
System.String childName

The name of the element to find.

Returns
Type Description
DependencyObject

The named element from the template, if the element is found. Can return null if no element with name childName was found in the template.

| Improve this Doc View Source

ManageIsEnabled(Boolean)

Declaration
protected override void ManageIsEnabled(bool isEnabled)
Parameters
Type Name Description
System.Boolean isEnabled
Overrides
FrameworkElement.ManageIsEnabled(Boolean)
| Improve this Doc View Source

MeasureOverride(Size)

Provides the behavior for the Measure pass of Silverlight layout. Classes can override this method to define their own Measure pass behavior.

Declaration
protected override Size MeasureOverride(Size availableSize)
Parameters
Type Name Description
Size availableSize

The available size that this object can give to child objects. Infinity (System.Double.PositiveInfinity) can be specified as a value to indicate that the object will size to whatever content is available.

Returns
Type Description
Size

The size that this object determines it needs during layout, based on its calculations of the allocated sizes for child objects; or based on other considerations, such as a fixed container size.

Overrides
FrameworkElement.MeasureOverride(Size)
| Improve this Doc View Source

OnApplyTemplate()

Declaration
public override void OnApplyTemplate()
Overrides
FrameworkElement.OnApplyTemplate()
| Improve this Doc View Source

OnDragEnter(DragEventArgs)

Declaration
[NotImplemented]
protected virtual void OnDragEnter(DragEventArgs e)
Parameters
Type Name Description
DragEventArgs e
| Improve this Doc View Source

OnDragLeave(DragEventArgs)

Declaration
[NotImplemented]
protected virtual void OnDragLeave(DragEventArgs e)
Parameters
Type Name Description
DragEventArgs e
| Improve this Doc View Source

OnDrop(DragEventArgs)

Declaration
[NotImplemented]
protected virtual void OnDrop(DragEventArgs e)
Parameters
Type Name Description
DragEventArgs e
| Improve this Doc View Source

OnGotFocus(RoutedEventArgs)

Called before the GotFocus event occurs.

Declaration
protected override void OnGotFocus(RoutedEventArgs e)
Parameters
Type Name Description
RoutedEventArgs e

The data for the event.

Overrides
UIElement.OnGotFocus(RoutedEventArgs)
| Improve this Doc View Source

OnLostFocus(RoutedEventArgs)

Called before the LostFocus event occurs.

Declaration
protected override void OnLostFocus(RoutedEventArgs e)
Parameters
Type Name Description
RoutedEventArgs e

The data for the event.

Overrides
UIElement.OnLostFocus(RoutedEventArgs)
| Improve this Doc View Source

OnTextInputUpdate(TextCompositionEventArgs)

Declaration
[NotImplemented]
protected virtual void OnTextInputUpdate(TextCompositionEventArgs e)
Parameters
Type Name Description
TextCompositionEventArgs e

Extension Methods

DependencyObjectHelper.GetSelfAndAncestors(DependencyObject)
UIElementExtendedRoutedEventExtensions.AddHandler(UIElement, ExtendedRoutedEvent, Delegate, Boolean)
UIElementExtendedRoutedEventExtensions.RemoveHandler(UIElement, ExtendedRoutedEvent, Delegate)
VisualTreeExtensions.GetVisualAncestors(DependencyObject)
VisualTreeExtensions.GetVisualAncestorsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualChildren(DependencyObject)
VisualTreeExtensions.GetVisualChildrenAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualDescendants(DependencyObject)
VisualTreeExtensions.GetVisualDescendantsAndSelf(DependencyObject)
VisualTreeExtensions.GetVisualSiblings(DependencyObject)
VisualTreeExtensions.GetVisualSiblingsAndSelf(DependencyObject)
VisualTreeExtensions.GetBoundsRelativeTo(FrameworkElement, UIElement)
VisualTreeExtensions.InvokeOnLayoutUpdated(FrameworkElement, Action)
  • Improve this Doc
  • View Source