Attached properties

January 5, 2024 ยท View on GitHub

Attached properties are properties that are defined on a type but are intended to be used with instances of other types. In Sharp.UI, attached properties are matched with attached property fluent methods, allowing you to set their values in a more readable and fluent manner.

For example, if you want to set the AbsoluteLayout.LayoutBounds attached property on a Border object, you would create an instance of Border and then use the AbsoluteLayoutBounds fluent method to set its value, like this:

new Border
{
    // ...
}.AbsoluteLayoutBounds(new Rect(100, 100, 200, 200));

This would set the AbsoluteLayout.LayoutBounds attached property to the specified rectangle value on the Border object.

Attached properties list

Maui attached propertySharp.UI fluent method
Shell.ItemTemplateShellItemTemplate()
FlyoutBase.ContextFlyoutContextFlyout()
Grid.ColumnColumn()
Grid.RowRow()
Grid.ColumnSpanColumnSpan()
Grid.RowSpanRowSpan()
Span(column, row)
VisualStateManager.VisualStateGroupsVisualStateGroups()
AbsoluteLayout.LayoutFlagsAbsoluteLayoutFlags()
AbsoluteLayout.LayoutBoundsAbsoluteLayoutBounds()
Shell.PresentationModeShellPresentationMode()
ShellBackgroundColorShellBackgroundColor()
Shell.ForegroundColorShellForegroundColor()
Shell.TitleColorShellTitleColor()
Shell.DisabledColorShellDisabledColor()
Shell.UnselectedColorShellUnselectedColor()
Shell.NavBarHasShadowShellNavBarHasShadow()
Shell.NavBarIsVisibleShellNavBarIsVisible()
Shell.TitleViewShellTitleView()
SemanticProperties.HintSemanticHint()
SemanticProperties.DescriptionSemanticDescription()
SemanticProperties.HeadingLevelSemanticHeadingLevel()
AutomationProperties.ExcludedWithChildrenAutomationExcludedWithChildren()
AutomationProperties.IsInAccessibleTreeAutomationIsInAccessibleTree()
AutomationProperties.NameAutomationName()
AutomationProperties.HelpTextAutomationHelpText()
AutomationProperties.LabeledByAutomationLabeledBy()