네이티브 스타일 지정 - .NET WPF

호스트 구성은 각 플랫폼에서 대부분의 방법을 얻을 수 있지만, 각 플랫폼에서 몇 가지 네이티브 스타일을 수행해야 할 가능성이 높습니다.

WPF를 사용하면 세분화된 스타일, 동작, 애니메이션 등에 대한 ResourceDictionary를 쉽게 전달할 수 있습니다.

요소 스타일 이름
AdaptiveCard Adaptive.Card
Action.OpenUrl Adaptive.Action.OpenUrl
Action.ShowCard Adaptive.Action.ShowCard
Action.Submit Adaptive.Action.Submit
Adaptive.Column, Adaptive.Action.Tap
ColumnSet Adaptive.ColumnSet, Adaptive.VerticalSeparator
컨테이너 Adaptive.Container
Input.ChoiceSet Adaptive.Input.ChoiceSet, Adaptive.Input.ChoiceSet.ComboBox, Adaptive.Input.ChoiceSet.CheckBox, Adaptive.Input.ChoiceSet.Radio, Adaptive.Input.ChoiceSet.ComboBoxItem
Input.Date Adaptive.Input.Text.Date
Input.Number Adaptive.Input.Text.Number
Input.Text Adaptive.Input.Text
Input.Time Adaptive.Input.Text.Time
Input.Toggle Adaptive.Input.Toggle
이미지 Adaptive.Image
Imageset Adaptive.ImageSet
FactSet Adaptive.FactSet, Adaptive.Fact.Title, Adaptive.Fact.Value
TextBlock Adaptive.TextBlock

이 샘플 XAML 리소스 사전은 모든 TextBlock의 배경을 Aqua로 설정합니다. 이보다 더 고급적인 것을 원할 것입니다. 😁

<ResourceDictionary
    xmlns="https://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="https://schemas.microsoft.com/winfx/2006/xaml">
    <Style x:Key="Adaptive.TextBlock" TargetType="TextBlock">
        <Setter Property="Background" Value="Aqua"></Setter>
    </Style>
</ResourceDictionary>
// Use a ResourceDictionary instance
// DON'T use this property if rendering from a server
renderer.Resources = myResourceDictionary;

// ... or load it from a file path
// USE this if rendering from a server
renderer.ResourcesPath = <path-to-my-resource-dictionary.xaml>;

중요

서버 쪽 이미지 생성에 대한 참고 사항 WPF 렌더러는 서버 쪽 이미지 생성에 사용할 수 있는 메서드를 제공합니다 RenderCardToImageAsync . 이 환경에서 사용되는 경우에만 속성을 사용해야 ResourcesPath 합니다. 자세한 내용은 이미지 렌더링 문서를 참조하세요.