요소 확장
확장은 Element
안쪽 여백, 효과, 글꼴 특성, 동적 리소스, 텍스트 및 텍스트 색의 구성을 지원하는 일련의 확장 메서드를 Element
제공합니다.
패딩
메서드는 Padding
에 속성을 Padding
IPaddingElement
설정합니다.
다음 예제에서는 다음으로 Padding
new Thickness(5, 10)
설정합니다.
new Button().Padding(5, 10);
다음 예제에서는 다음으로 new Thickness(10, 20, 30, 40)
설정합니다Padding
.
new Button().Padding(new Thickness(10, 20, 30, 40));
new Button().Paddings(10, 20, 30, 40);
RemoveDynamicResources
이 메서드는 RemoveDynamicResources
지정된 BindableObject
에서 모든 동적 리소스를 제거합니다.
다음 예제에서는 다음에서 다음을 BackgroundColorProperty
TextColorProperty
제거합니다.DynamicResource
var button = new Button().DynamicResources(
(Button.BackgroundColorProperty, "ButtonBackgroundColor"),
(Button.TextColorProperty, "ButtonTextColor"));
button.RemoveDynamicResources(Button.BackgroundColorProperty, Button.TextColorProperty);
효과
메서드는 Effects
제공된 Effect
항목을 .에 연결합니다 Element
.
다음 예제에서는 다음을 ShadowEffect
연결합니다 TouchEffect
Element
.
new Button().Effects(new ShadowEffect(), new TouchEffect());
글꼴 크기
메서드는 FontSize
요소의 FontSize
속성을 IFontElement
설정합니다.
다음 예제에서는 다음으로 FontSize
12
설정합니다.
new Button().FontSize(12);
굵게
Bold
요소에 대한 메서드 집합 FontAttributes = FontAttributes.Bold
입니다IFontElement
.
다음 예제에서는 단추 글꼴을 굵게 설정합니다.
new Button().Bold()
Normal
Italic
요소에 대한 메서드 집합 FontAttributes = FontAttributes.Italic
입니다IFontElement
.
다음 예제에서는 단추 글꼴을 기울음꼴로 설정합니다.
new Button().Italic()
글꼴
메서드는 요소 및 요소를 설정합니다FontAttributes
.FontFamily
FontSize
IFontElement
Font
다음 예제에서는 단추 글꼴을 기울음꼴로 설정합니다.
new Button().Font(family: "OpenSansRegular", size: 12.5, bold: true, italic: true);
TextColor
메서드는 TextColor
요소의 TextColor
속성을 ITextStyle
설정합니다.
다음 예제에서는 다음으로 TextColor
Colors.Green
설정합니다.
new Button().TextColor(Colors.Green);
Text
메서드는 Text
요소의 Text
속성을 IText
설정합니다.
다음 예제에서는 다음으로 Text
"Tap Here"
설정합니다.
new Button().Text("Tap Here");
다음 예제에서는 to를 Text
"Tap Here"
설정하고 속성을 다음으로 TextColor
Colors.Blue
설정합니다.
new Button().Text("Tap Here", Colors.Blue);
.NET MAUI Community Toolkit
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기