Class ContentControl
Displays Content according to an IDataTemplate.
[TemplatePart("PART_ContentPresenter", typeof(ContentPresenter))]
public class ContentControl : TemplatedControl, INotifyPropertyChanged, IDataContextProvider, ILogical, IThemeVariantHost, IResourceHost, IResourceNode, IStyleHost, ISetLogicalParent, ISetInheritanceParent, ISupportInitialize, IStyleable, INamed, IInputElement, IDataTemplateHost, ISetterValue
- Inheritance
-
ContentControl
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ContentControl()
public ContentControl()
Fields
ContentProperty
Defines the Content property.
public static readonly StyledProperty<object?> ContentProperty
Field Value
ContentTemplateProperty
Defines the ContentTemplate property.
public static readonly StyledProperty<IDataTemplate?> ContentTemplateProperty
Field Value
HorizontalContentAlignmentProperty
Defines the HorizontalContentAlignment property.
public static readonly StyledProperty<HorizontalAlignment> HorizontalContentAlignmentProperty
Field Value
VerticalContentAlignmentProperty
Defines the VerticalContentAlignment property.
public static readonly StyledProperty<VerticalAlignment> VerticalContentAlignmentProperty
Field Value
Properties
Content
Gets or sets the content to display.
[Content]
[DependsOn("ContentTemplate")]
public object? Content { get; set; }
Property Value
ContentTemplate
Gets or sets the data template used to display the content of the control.
public IDataTemplate? ContentTemplate { get; set; }
Property Value
HorizontalContentAlignment
Gets or sets the horizontal alignment of the content within the control.
public HorizontalAlignment HorizontalContentAlignment { get; set; }
Property Value
Presenter
Gets the presenter from the control's template.
public ContentPresenter? Presenter { get; }
Property Value
VerticalContentAlignment
Gets or sets the vertical alignment of the content within the control.
public VerticalAlignment VerticalContentAlignment { get; set; }
Property Value
Methods
OnPropertyChanged(AvaloniaPropertyChangedEventArgs)
Called when a avalonia property changes on the object.
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
Parameters
change
AvaloniaPropertyChangedEventArgsThe property change details.
RegisterContentPresenter(ContentPresenter)
Called when an ContentPresenter is registered with the control.
protected virtual bool RegisterContentPresenter(ContentPresenter presenter)
Parameters
presenter
ContentPresenterThe presenter.