시멘틱
시멘틱 정보는 일종의 메타정보이며 사람이 식별하거나 기기에서 식별할 수 있는 정보를 제공합니다.
앱 수명 주기

앱 수명주기를 MAUI 관점에서 또는 플렛폼별로 관여할 수 있습니다.
앱 시작
MauiProgram.cs
을 통해 시작 시 여러가지 설정을 할 수 있습니다. 글꼴이나 폰트를 등록할 수 있고 핸들러나 서비스를 등록할 수 있습니다.
렌더러 역시 핸들러를 통해 처리될 수 있는데 다음의 코드처럼 각 플렛폼별로 렌더러를 등록할 수 있습니다.
...
#if ANDROID
.ConfigureMauiHandlers(handlers =>
{
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.BoxView),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.Android.BoxRenderer));
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.Frame),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.Android.FastRenderers.FrameRenderer));
});
#elif IOS
.ConfigureMauiHandlers(handlers =>
{
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.BoxView),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.iOS.BoxRenderer));
handlers.AddCompatibilityRenderer(typeof(Microsoft.Maui.Controls.Frame),
typeof(Microsoft.Maui.Controls.Compatibility.Platform.iOS.FrameRenderer));
});
#endif
...
Behavior
상속을 하지 않고도 사용자 인터페이스 컨트롤에 기능을 추가 할 수 있습니다. WPF 그것과 유사합니다.
...
public static class AttachedNumericValidationBehavior
{
public static readonly BindableProperty AttachBehaviorProperty =
BindableProperty.CreateAttached("AttachBehavior", typeof(bool), typeof(AttachedNumericValidationBehavior), false, propertyChanged: OnAttachBehaviorChanged);
...
데이터 바인딩
별도 정리
제스처
Drag&Drop, Pan, Pinch, Swipe, Tap의 다양한 제스처를 처리할 수 있습니다.
속성
바인딩 가능 속성(Bindable property)과, 첨부 속성(Attached property) 모두 WPF의 그것과 유사합니다.
메시지 게시 및 구독
발행-구독 패턴은 발행자와 구독자를 직접 참조하지 않고도 필요한 메시지를 보내고 받을 수 있는 패턴입니다. MAUI에서는 MessagingCenter
를 이용해 이 패턴을 사용할 수 있습니다. 이를 이용해 컨트롤와 컨트롤간 메시지를 주고 받을 수 있습니다.
리소스 사전
ResourceDictionary
를 이용해 리소스를 레파지토리로 관리할 수 있습니다. WPF의 그것과 유사합니다.
Shell
단일 프로젝트
다양한 프로젝트 설정으로 리소스에 대한 디렉토리 경로를 지정할 수 있습니다.
<ItemGroup>
<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<!-- Fonts -->
<MauiFont Include="Resources\Fonts\*" />
<!-- Assets -->
<MauiAsset Include="Resources\Assets\*" />
</ItemGroup>
템플릿
WPF의 그것과 같이 ControlTemplate
, DateTemplate
을 사용합니다.
트리거
트리거를 통해 XAML에서 다양한 변화를 감지하여 다른 동작에 연결할 수 있습니다. 구성은 WPF의 트리거와 유사합니다.
창
오늘 기초
부분을 전반적으로 살펴봤는데 WPF 개발자라면 빠르게 MAUI에 익숙해질 수 있도록 기존 기술을 거의 대부분 계승해서 사용했네요. 다음 시간에는 MAUI 컨트롤을 중점적으로 배워볼 생각입니다.