Attached Property'ler

July 15, 2026 · View on GitHub

Attached property'ler bir tipte tanımlanıp başka tiplerin örneklerinde ayarlanan özelliklerdir — Grid.Row, Shell.TitleColor, SemanticProperties.Hint vb. FmgLib.MauiMarkup her birini normal özellik gibi okunan bir fluent metoda eşler.

Hızlı Örnek

// XAML:  <Border AbsoluteLayout.LayoutBounds="100,100,200,200" />
new Border().AbsoluteLayoutBounds(new Rect(100, 100, 200, 200));

// Rect kurmadan kolaylık overload'u:
new Border().AbsoluteLayoutBounds(100, 100, 200, 200);

Tam Eşleme Tablosu

Grid

MAUI attached propertyFluent metot
Grid.ColumnColumn()
Grid.RowRow()
Grid.ColumnSpanColumnSpan()
Grid.RowSpanRowSpan()
Grid.ColumnSpan + Grid.RowSpanGridSpan(column, row)
new Image().Row(0).Column(1).RowSpan(2)

AbsoluteLayout

MAUI attached propertyFluent metot
AbsoluteLayout.LayoutFlagsAbsoluteLayoutFlags()
AbsoluteLayout.LayoutBoundsAbsoluteLayoutBounds()
new AbsoluteLayout().Children(
    new BoxView()
        .Color(Colors.Teal)
        .AbsoluteLayoutFlags(AbsoluteLayoutFlags.PositionProportional)
        .AbsoluteLayoutBounds(new Rect(0.5, 0.5, 100, 100))   // ortalı, 100×100
)

BindableLayout (herhangi bir layout'ta)

MAUI attached propertyFluent metot
BindableLayout.ItemsSourceBindableLayoutItemsSource()
BindableLayout.ItemTemplateBindableLayoutItemTemplate()
BindableLayout.TemplateSelectorBindableItemTemplateSelector()
BindableLayout.EmptyViewBindableLayoutEmptyView()
BindableLayout.EmptyViewTemplateBindableLayoutEmptyViewTemplate()

Tam örnekler için bkz. Koleksiyonlar ve Şablonlar.

RadioButton grupları

MAUI attached propertyFluent metot
RadioButtonGroup.GroupNameRadioButtonGroupGroupName()
RadioButtonGroup.SelectedValueRadioButtonGroupSelectedValue()
new VerticalStackLayout()
    .RadioButtonGroupGroupName("Sizes")
    .RadioButtonGroupSelectedValue(e => e.Path("SelectedSize").BindingMode(BindingMode.TwoWay))
    .Children(
        new RadioButton().Content("S").Value("S"),
        new RadioButton().Content("M").Value("M"),
        new RadioButton().Content("L").Value("L")
    )

Flyout / bağlam menüleri

MAUI attached propertyFluent metot
FlyoutBase.ContextFlyoutContextFlyout()

Bkz. Menüler.

VisualStateManager

MAUI attached propertyFluent metot
VisualStateManager.VisualStateGroupsVisualStateGroups()

Bkz. Visual State'ler.

Shell (sayfalarda/öğelerde ayarlanır)

MAUI attached propertyFluent metot
Shell.PresentationModeShellPresentationMode()
Shell.BackgroundColorShellBackgroundColor()
Shell.ForegroundColorShellForegroundColor()
Shell.TitleColorShellTitleColor()
Shell.DisabledColorShellDisabledColor()
Shell.UnselectedColorShellUnselectedColor()
Shell.NavBarHasShadowShellNavBarHasShadow()
Shell.NavBarIsVisibleShellNavBarIsVisible()
Shell.TitleViewShellTitleView()
Shell.TabBarBackgroundColorShellTabBarBackgroundColor()
Shell.TabBarForegroundColorShellTabBarForegroundColor()
Shell.TabBarTitleColorShellTabBarTitleColor()
Shell.TabBarDisabledColorShellTabBarDisabledColor()
Shell.TabBarUnselectedColorShellTabBarUnselectedColor()
Shell.TabBarIsVisibleShellTabBarIsVisible()
Shell.FlyoutBackdropShellFlyoutBackdrop()
Shell.FlyoutBehaviorShellFlyoutBehavior()
Shell.FlyoutHeightShellFlyoutHeight()
Shell.FlyoutWidthShellFlyoutWidth()
Shell.FlyoutItemIsVisibleShellFlyoutItemIsVisible()
Shell.BackButtonBehaviorShellBackButtonBehavior()
Shell.ItemTemplateShellItemTemplate()
Shell.MenuItemTemplateShellMenuItemTemplate()
Shell.SearchHandlerShellSearchHandler()

Örnek — giriş sayfasında nav bar ve tab bar'ı gizle:

public partial class LoginPage : ContentPage, IFmgLibHotReload
{
    public LoginPage() => this.InitializeHotReload();

    public void Build() =>
        this
        .ShellNavBarIsVisible(false)
        .ShellTabBarIsVisible(false)
        .Content(/* ... */);
}
MAUI attached propertyFluent metot
NavigationPage.HasNavigationBarNavigationPageHasNavigationBar()
NavigationPage.BackButtonTitleNavigationPageBackButtonTitle()
NavigationPage.HasBackButtonNavigationPageHasBackButton()
NavigationPage.IconColorNavigationPageIconColor()
NavigationPage.TitleIconImageSourceNavigationPageTitleIconImageSource()
NavigationPage.TitleViewNavigationPageTitleView()

Erişilebilirlik — Semantic ve Automation

MAUI attached propertyFluent metot
SemanticProperties.HintSemanticHint()
SemanticProperties.DescriptionSemanticDescription()
SemanticProperties.HeadingLevelSemanticHeadingLevel()
AutomationProperties.ExcludedWithChildrenAutomationExcludedWithChildren()
AutomationProperties.IsInAccessibleTreeAutomationIsInAccessibleTree()
AutomationProperties.NameAutomationName()
AutomationProperties.HelpTextAutomationHelpText()
AutomationProperties.LabeledByAutomationLabeledBy()
new Image()
    .Source("logo.png")
    .SemanticDescription("Şirket logosu")
    .SemanticHint("Sayfanın üstündeki dekoratif görsel")

new Label()
    .Text("Ayarlar")
    .SemanticHeadingLevel(SemanticHeadingLevel.Level1)

Araç ipuçları

MAUI attached propertyFluent metot
ToolTipProperties.TextToolTipPropertiesText()
new Button().Text("?").ToolTipPropertiesText("Yardım merkezini açar")

Adlandırma Kuralı

Metot adını tahmin etmenin temel kuralı:

  • Grid yerleşimi sahip önekini atar: Grid.RowRow().
  • Diğer her şey sahip + özellik birleşimidir: Shell.TitleColorShellTitleColor(), SemanticProperties.HintSemanticHint(), AutomationProperties.NameAutomationName().

Aynı kural [MauiMarkupAttachedProp] ile üretilen üçüncü parti attached property'ler için de geçerlidir — örn. InputKit'in FormView.IsSubmitButtonFormViewIsSubmitButton() olur.

Builder Desteği

Attached-property metotları da her özellik gibi property builder lambda'sı kabul eder; binding'ler ve tema/platform değerleri çalışır:

new ContentPage()
    .ShellTabBarIsVisible(e => e.Path("IsTabBarVisible"))
    .ShellBackgroundColor(e => e.OnLight(Colors.White).OnDark(Colors.Black))

İlgili Konular