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#
C# Copy
new Border ().AbsoluteLayoutBounds (new Rect (100 , 100 , 200 , 200 ));
new Border ().AbsoluteLayoutBounds (100 , 100 , 200 , 200 );
Tam Eşleme Tablosu#
Grid#
MAUI attached property
Fluent metot
Grid.Column
Column()
Grid.Row
Row()
Grid.ColumnSpan
ColumnSpan()
Grid.RowSpan
RowSpan()
Grid.ColumnSpan + Grid.RowSpan
GridSpan(column, row)
C# Copy
new Image ().Row (0 ).Column (1 ).RowSpan (2 )
AbsoluteLayout#
MAUI attached property
Fluent metot
AbsoluteLayout.LayoutFlags
AbsoluteLayoutFlags()
AbsoluteLayout.LayoutBounds
AbsoluteLayoutBounds()
C# Copy
new AbsoluteLayout ().Children (
new BoxView ()
.Color (Colors .Teal )
.AbsoluteLayoutFlags (AbsoluteLayoutFlags .PositionProportional )
.AbsoluteLayoutBounds (new Rect (0.5 , 0.5 , 100 , 100 ))
)
BindableLayout (herhangi bir layout'ta)#
MAUI attached property
Fluent metot
BindableLayout.ItemsSource
BindableLayoutItemsSource()
BindableLayout.ItemTemplate
BindableLayoutItemTemplate()
BindableLayout.TemplateSelector
BindableItemTemplateSelector()
BindableLayout.EmptyView
BindableLayoutEmptyView()
BindableLayout.EmptyViewTemplate
BindableLayoutEmptyViewTemplate()
Tam örnekler için bkz. Koleksiyonlar ve Şablonlar .
MAUI attached property
Fluent metot
RadioButtonGroup.GroupName
RadioButtonGroupGroupName()
RadioButtonGroup.SelectedValue
RadioButtonGroupSelectedValue()
C# Copy
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" )
)
MAUI attached property
Fluent metot
FlyoutBase.ContextFlyout
ContextFlyout()
Bkz. Menüler .
VisualStateManager#
MAUI attached property
Fluent metot
VisualStateManager.VisualStateGroups
VisualStateGroups()
Bkz. Visual State'ler .
Shell (sayfalarda/öğelerde ayarlanır)#
MAUI attached property
Fluent metot
Shell.PresentationMode
ShellPresentationMode()
Shell.BackgroundColor
ShellBackgroundColor()
Shell.ForegroundColor
ShellForegroundColor()
Shell.TitleColor
ShellTitleColor()
Shell.DisabledColor
ShellDisabledColor()
Shell.UnselectedColor
ShellUnselectedColor()
Shell.NavBarHasShadow
ShellNavBarHasShadow()
Shell.NavBarIsVisible
ShellNavBarIsVisible()
Shell.TitleView
ShellTitleView()
Shell.TabBarBackgroundColor
ShellTabBarBackgroundColor()
Shell.TabBarForegroundColor
ShellTabBarForegroundColor()
Shell.TabBarTitleColor
ShellTabBarTitleColor()
Shell.TabBarDisabledColor
ShellTabBarDisabledColor()
Shell.TabBarUnselectedColor
ShellTabBarUnselectedColor()
Shell.TabBarIsVisible
ShellTabBarIsVisible()
Shell.FlyoutBackdrop
ShellFlyoutBackdrop()
Shell.FlyoutBehavior
ShellFlyoutBehavior()
Shell.FlyoutHeight
ShellFlyoutHeight()
Shell.FlyoutWidth
ShellFlyoutWidth()
Shell.FlyoutItemIsVisible
ShellFlyoutItemIsVisible()
Shell.BackButtonBehavior
ShellBackButtonBehavior()
Shell.ItemTemplate
ShellItemTemplate()
Shell.MenuItemTemplate
ShellMenuItemTemplate()
Shell.SearchHandler
ShellSearchHandler()
Örnek — giriş sayfasında nav bar ve tab bar'ı gizle:
C# Copy
public partial class LoginPage : ContentPage , IFmgLibHotReload
{
public LoginPage () => this .InitializeHotReload ();
public void Build () =>
this
.ShellNavBarIsVisible (false )
.ShellTabBarIsVisible (false )
.Content ();
}
NavigationPage (sayfalarda ayarlanır)#
MAUI attached property
Fluent metot
NavigationPage.HasNavigationBar
NavigationPageHasNavigationBar()
NavigationPage.BackButtonTitle
NavigationPageBackButtonTitle()
NavigationPage.HasBackButton
NavigationPageHasBackButton()
NavigationPage.IconColor
NavigationPageIconColor()
NavigationPage.TitleIconImageSource
NavigationPageTitleIconImageSource()
NavigationPage.TitleView
NavigationPageTitleView()
Erişilebilirlik — Semantic ve Automation#
MAUI attached property
Fluent metot
SemanticProperties.Hint
SemanticHint()
SemanticProperties.Description
SemanticDescription()
SemanticProperties.HeadingLevel
SemanticHeadingLevel()
AutomationProperties.ExcludedWithChildren
AutomationExcludedWithChildren()
AutomationProperties.IsInAccessibleTree
AutomationIsInAccessibleTree()
AutomationProperties.Name
AutomationName()
AutomationProperties.HelpText
AutomationHelpText()
AutomationProperties.LabeledBy
AutomationLabeledBy()
C# Copy
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 property
Fluent metot
ToolTipProperties.Text
ToolTipPropertiesText()
C# Copy
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.Row → Row().
Diğer her şey sahip + özellik birleşimidir: Shell.TitleColor → ShellTitleColor(), SemanticProperties.Hint → SemanticHint(), AutomationProperties.Name → AutomationName().
Aynı kural [MauiMarkupAttachedProp] ile üretilen üçüncü parti attached property'ler için de geçerlidir — örn. InputKit'in FormView.IsSubmitButton'ı FormViewIsSubmitButton() 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:
C# Copy
new ContentPage ()
.ShellTabBarIsVisible (e => e.Path ("IsTabBarVisible" ))
.ShellBackgroundColor (e => e.OnLight (Colors .White ).OnDark (Colors .Black ))
İlgili Konular#