ContentPresenter Class
Definition
Presents a single item of data inside a Avalonia.Controls.Primitives.TemplatedControl template.
public class ContentPresenter
Constructors
| Name | Description |
|---|---|
| ContentPresenter | No summary available. |
ContentPresenter Constructor
public ContentPresenter()
Methods
| Name | Description |
|---|---|
| AddHandler (2 overloads) | Adds a handler for the specified routed event. Inherited from Interactive. |
| ApplyStyling | Applies styling to the control if the control is initialized and styling is not already applied. Inherited from StyledElement. |
| ApplyTemplate | Creates the visual children of the control, if necessary |
| Arrange | Arranges the control and its children. Inherited from Layoutable. |
| BeginInit | Inherited from StyledElement. |
| Bind (8 overloads) | Binds a Avalonia.AvaloniaProperty to an Avalonia.Data.BindingBase. Inherited from AvaloniaObject. |
| CheckAccess | Returns a value indicating whether the current thread is the UI thread. Inherited from AvaloniaObject. |
| ClearValue (4 overloads) | Clears a Avalonia.AvaloniaProperty's local value. Inherited from AvaloniaObject. |
| CoerceValue | Coerces the specified Avalonia.AvaloniaProperty. Inherited from AvaloniaObject. |
| EndInit | Inherited from StyledElement. |
| Equals | Compares two objects using reference equality. Inherited from AvaloniaObject. |
| Focus | Focuses the control. Inherited from InputElement. |
| GetBaseValue | Inherited from AvaloniaObject. |
| GetFlowDirection | Gets the value of the attached Avalonia.Visual.FlowDirectionProperty on a control. Inherited from Visual. |
| GetHashCode | Gets the hash code for the object. Inherited from AvaloniaObject. |
| GetIsHoldingEnabled | Inherited from InputElement. |
| GetIsHoldWithMouseEnabled | Inherited from InputElement. |
| GetValue (3 overloads) | Gets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject. |
| InvalidateArrange | Invalidates the arrangement of the control and queues a new layout pass. Inherited from Layoutable. |
| InvalidateMeasure | Invalidates the measurement of the control and queues a new layout pass. Inherited from Layoutable. |
| InvalidateVisual | Invalidates the visual and queues a repaint. Inherited from Visual. |
| IsAnimating | Checks whether a Avalonia.AvaloniaProperty is animating. Inherited from AvaloniaObject. |
| IsSet | Checks whether a Avalonia.AvaloniaProperty is set on this object. Inherited from AvaloniaObject. |
| Measure | Carries out a measure of the control. Inherited from Layoutable. |
| RaiseEvent | Raises a routed event. Inherited from Interactive. |
| RemoveHandler (2 overloads) | Removes a handler for the specified routed event. Inherited from Interactive. |
| Render | Renders the visual to a Avalonia.Media.DrawingContext. |
| SetCurrentValue (2 overloads) | Sets the value of a dependency property without changing its value source. Inherited from AvaloniaObject. |
| SetFlowDirection | Sets the value of the attached Avalonia.Visual.FlowDirectionProperty on a control. Inherited from Visual. |
| SetIsHoldingEnabled | Inherited from InputElement. |
| SetIsHoldWithMouseEnabled | Inherited from InputElement. |
| SetValue (3 overloads) | Sets a Avalonia.AvaloniaProperty value. Inherited from AvaloniaObject. |
| TryGetResource | Inherited from StyledElement. |
| UpdateChild | Updates the Avalonia.Controls.Presenters.ContentPresenter.Child control based on the control's Avalonia.Controls.Presenters.ContentPresenter.Content. |
| UpdateLayout | Executes a layout pass. Inherited from Layoutable. |
| VerifyAccess | Checks that the current thread is the UI thread and throws if not. Inherited from AvaloniaObject. |
ApplyTemplate Method
Creates the visual children of the control, if necessary
public void ApplyTemplate()
Render Method
Renders the visual to a Avalonia.Media.DrawingContext.
public void Render(Avalonia.Media.DrawingContext context)
Parameters
context Avalonia.Media.DrawingContext
The drawing context.
UpdateChild Method
Updates the Avalonia.Controls.Presenters.ContentPresenter.Child control based on the control's Avalonia.Controls.Presenters.ContentPresenter.Content.
public void UpdateChild()
Remarks
Usually the Avalonia.Controls.Presenters.ContentPresenter.Child control is created automatically when Avalonia.Controls.Presenters.ContentPresenter.ApplyTemplate is called; however for this to happen, the control needs to be attached to a logical tree (if the control is not attached to the logical tree, it is reasonable to expect that the DataTemplates needed for the child are not yet available). This method forces the Avalonia.Controls.Presenters.ContentPresenter.Child control's creation at any point, and is particularly useful in unit tests.
Properties
| Name | Description |
|---|---|
| ActualThemeVariant | Gets the UI theme that is currently used by the element, which might be different than the RequestedThemeVariantProperty. Inherited from StyledElement. |
| Background | Gets or sets a brush with which to paint the background. |
| BackgroundSizing | Gets or sets how the background is drawn relative to the border. |
| BorderBrush | Gets or sets a brush with which to paint the border. |
| BorderThickness | Gets or sets the thickness of the border. |
| Bounds | Gets the bounds of the control relative to its parent. Inherited from Visual. |
| BoxShadow | Gets or sets the box shadow effect parameters |
| CacheMode | Gets or sets the cache mode of the visual. Inherited from Visual. |
| Child | Gets the control displayed by the presenter. |
| Classes | Gets or sets the styled element's classes. Inherited from StyledElement. |
| Clip | Gets or sets the geometry clip for this visual. Inherited from Visual. |
| ClipToBounds | Gets or sets a value indicating whether the control should be clipped to its bounds. Inherited from Visual. |
| Content | Gets or sets the content to be displayed by the presenter. |
| ContentTemplate | Gets or sets the data template used to display the content of the control. |
| ContextFlyout | Gets or sets a context flyout to the control Inherited from Control. |
| ContextMenu | Gets or sets a context menu to the control. Inherited from Control. |
| CornerRadius | Gets or sets the radius of the border rounded corners. |
| Cursor | Gets or sets associated mouse cursor. Inherited from InputElement. |
| DataContext | Gets or sets the control's data context. Inherited from StyledElement. |
| DataTemplates | Gets or sets the data templates for the control. Inherited from Control. |
| DesiredSize | Gets the size that this element computed during the measure pass of the layout process. Inherited from Layoutable. |
| Dispatcher | Returns the Avalonia.AvaloniaObject.Dispatcher that this Avalonia.AvaloniaObject is associated with. Inherited from AvaloniaObject. |
| Effect | Gets or sets the effect of the control. Inherited from Visual. |
| FlowDirection | Gets or sets the text flow direction. Inherited from Visual. |
| Focusable | Gets or sets a value indicating whether the control can receive focus. Inherited from InputElement. |
| FocusAdorner | Gets or sets the control's focus adorner. Inherited from Control. |
| FontFamily | Gets or sets the font family. |
| FontSize | Gets or sets the font size. |
| FontStretch | Gets or sets the font stretch. |
| FontStyle | Gets or sets the font style. |
| FontWeight | Gets or sets the font weight. |
| Foreground | Gets or sets a brush used to paint the text. |
| GestureRecognizers | Inherited from InputElement. |
| HasMirrorTransform | Gets or sets a value indicating whether to apply mirror transform on this control. Inherited from Visual. |
| Height | Gets or sets the height of the element. Inherited from Layoutable. |
| HorizontalAlignment | Gets or sets the element's preferred horizontal alignment in its parent. Inherited from Layoutable. |
| HorizontalContentAlignment | Gets or sets the horizontal alignment of the content within the border the control. |
| IsArrangeValid | Gets a value indicating whether the control's layouts arrange is valid. Inherited from Layoutable. |
| IsEffectivelyEnabled | Gets a value indicating whether this control and all its parents are enabled. Inherited from InputElement. |
| IsEffectivelyVisible | Gets a value indicating whether this control and all its parents are visible. Inherited from Visual. |
| IsEnabled | Gets or sets a value indicating whether the control is enabled for user interaction. Inherited from InputElement. |
| IsFocused | Gets a value indicating whether the control is focused. Inherited from InputElement. |
| IsHitTestVisible | Gets or sets a value indicating whether the control is considered for hit testing. Inherited from InputElement. |
| IsInitialized | Gets a value that indicates whether the element has finished initialization. Inherited from StyledElement. |
| IsKeyboardFocusWithin | Gets a value indicating whether keyboard focus is anywhere within the element or its visual tree child elements. Inherited from InputElement. |
| IsLoaded | Gets a value indicating whether the control is fully constructed in the visual tree and both layout and render are complete. Inherited from Control. |
| IsMeasureValid | Gets a value indicating whether the control's layout measure is valid. Inherited from Layoutable. |
| IsPointerOver | Gets a value indicating whether the pointer is currently over the control. Inherited from InputElement. |
| IsTabStop | Gets or sets a value that indicates whether the control is included in tab navigation. Inherited from InputElement. |
| IsVisible | Gets or sets a value indicating whether this control is visible. Inherited from Visual. |
| Item | Inherited from AvaloniaObject. |
| KeyBindings | Inherited from InputElement. |
| LetterSpacing | Gets or sets the letter spacing |
| LineHeight | Gets or sets the line height |
| Margin | Gets or sets the margin around the element. Inherited from Layoutable. |
| MaxHeight | Gets or sets the maximum height of the element. Inherited from Layoutable. |
| MaxLines | Gets or sets the max lines |
| MaxWidth | Gets or sets the maximum width of the element. Inherited from Layoutable. |
| MinHeight | Gets or sets the minimum height of the element. Inherited from Layoutable. |
| MinWidth | Gets or sets the minimum width of the element. Inherited from Layoutable. |
| Name | Gets or sets the name of the styled element. Inherited from StyledElement. |
| Opacity | Gets or sets the opacity of the control. Inherited from Visual. |
| OpacityMask | Gets or sets the opacity mask of the control. Inherited from Visual. |
| Padding | Gets or sets the space between the border and the Avalonia.Controls.Presenters.ContentPresenter.Child control. |
| Parent | Gets the styled element's logical parent. Inherited from StyledElement. |
| RecognizesAccessKey | Determine if Avalonia.Controls.Presenters.ContentPresenter should use Avalonia.Controls.Primitives.AccessText in its style |
| RenderTransform | Gets or sets the render transform of the control. Inherited from Visual. |
| RenderTransformOrigin | Gets or sets the transform origin of the control. Inherited from Visual. |
| Resources | Gets or sets the styled element's resource dictionary. Inherited from StyledElement. |
| StyleKey | Gets the type by which the element is styled. Inherited from StyledElement. |
| Styles | Gets the styles for the styled element. Inherited from StyledElement. |
| 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. Inherited from InputElement. |
| Tag | Gets or sets a user-defined object attached to the control. Inherited from Control. |
| TemplatedParent | Gets the styled element whose lookless template this styled element is part of. Inherited from StyledElement. |
| TextAlignment | Gets or sets the text alignment |
| TextTrimming | Gets or sets the text trimming |
| TextWrapping | Gets or sets the text wrapping |
| Theme | Gets or sets the theme to be applied to the element. Inherited from StyledElement. |
| Transitions | Gets or sets the property transitions for the control. Inherited from Animatable. |
| UseLayoutRounding | Gets or sets a value that determines whether the element should be snapped to pixel boundaries at layout time. Inherited from Layoutable. |
| VerticalAlignment | Gets or sets the element's preferred vertical alignment in its parent. Inherited from Layoutable. |
| VerticalContentAlignment | Gets or sets the vertical alignment of the content within the border of the control. |
| Width | Gets or sets the width of the element. Inherited from Layoutable. |
| ZIndex | Gets or sets the Z index of the control. Inherited from Visual. |
Background Property
Gets or sets a brush with which to paint the background.
public Avalonia.Media.IBrush Background { get; set; }
BackgroundSizing Property
Gets or sets how the background is drawn relative to the border.
public Avalonia.Media.BackgroundSizing BackgroundSizing { get; set; }
BorderBrush Property
Gets or sets a brush with which to paint the border.
public Avalonia.Media.IBrush BorderBrush { get; set; }
BorderThickness Property
Gets or sets the thickness of the border.
public Avalonia.Thickness BorderThickness { get; set; }
BoxShadow Property
Gets or sets the box shadow effect parameters
public Avalonia.Media.BoxShadows BoxShadow { get; set; }
Child Property
Gets the control displayed by the presenter.
public Avalonia.Controls.Control Child { get; set; }
Content Property
Gets or sets the content to be displayed by the presenter.
public object Content { get; set; }
ContentTemplate Property
Gets or sets the data template used to display the content of the control.
public Avalonia.Controls.Templates.IDataTemplate ContentTemplate { get; set; }
CornerRadius Property
Gets or sets the radius of the border rounded corners.
public Avalonia.CornerRadius CornerRadius { get; set; }