728x90
728x170
▶ MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<ContentPage.Resources>
<Style x:Key="LabelStyleKey" TargetType="Label">
<Setter Property="TextColor" Value="{AppThemeBinding Black, Light=Blue, Dark=Teal}" />
</Style>
</ContentPage.Resources>
<StackLayout
Margin="10"
HorizontalOptions="Center"
VerticalOptions="Center">
<Label
HorizontalOptions="Center"
TextColor="{AppThemeBinding Light=Green, Dark=Red}"
Text="This text is green in light mode, and red in dark mode." />
<Label
Style="{StaticResource LabelStyleKey}"
Margin="0,50,0,0"
HorizontalOptions="Center"
Text="This text is black by default, blue in light mode, and teal in dark mode." />
</StackLayout>
</ContentPage>
728x90
그리드형(광고전용)
'C# > MAUI' 카테고리의 다른 글
[C#/MAUI/.NET6] x:FactoryMethod 속성 : 팩토리 메소드 호출하기 (0) | 2022.03.04 |
---|---|
[C#/MAUI/.NET6] x:Arguments 엘리먼트 : 생성자 인수 전달하기 (0) | 2022.03.04 |
[C#/MAUI/.NET6] XmlnsPrefixAttribute 클래스 : 커스텀 네임스페이스 접두사 사용하기 (0) | 2022.03.04 |
[C#/MAUI/.NET6] XmlnsDefinitionAttribute 클래스 : 사용자 지정 네임스페이스 스키마 사용하기 (0) | 2022.03.04 |
[C#/MAUI/.NET6] IMarkupExtension<T> 인터페이스 : 커스텀 마크업 확장 사용하기 (0) | 2022.03.04 |
[C#/MAUI/.NET6] DataTemplate 태그 확장 사용하기 (0) | 2022.03.03 |
[C#/MAUI/.NET6] OnIdiom 태그 확장 사용하기 (0) | 2022.03.03 |
[C#/MAUI/.NET6] OnPlatform 태그 확장 : double 값 설정하기 (0) | 2022.03.03 |
[C#/MAUI/.NET6] x:Null 태그 확장 사용하기 (0) | 2022.03.03 |
[C#/MAUI/.NET6] x:Array 엘리먼트 : 색상 배열 사용하기 (0) | 2022.03.03 |