` containing the inner card)
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-html/extensibility.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Extensibility - .NET HTML SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Extensibility - .NET HTML
10 |
11 | ## Custom Element Rendering
12 |
13 | For full control of the renderer you can use the `ElementRenderers` property to **add**, **remove**, or **override** default renderers.
14 |
15 | The following example shows how you could define a custom `"type": "Rating"` element and render it.
16 |
17 | ```csharp
18 | // Register the new type with the JSON parser
19 | AdaptiveTypedElementConverter.RegisterTypedElement
();
20 |
21 | // Add the new type to the element renderer registry
22 | renderer.ElementRenderers.Set(MyCustomRating.Render);
23 |
24 | // Define a custom Rating element type
25 | public class MyCustomRating : AdaptiveElement
26 | {
27 | public override string Type => "Rating";
28 |
29 | public double Rating { get; set; }
30 |
31 | public AdaptiveTextSize Size { get; set; }
32 |
33 | public AdaptiveTextColor Color { get; set; }
34 |
35 | public static FrameworkElement Render(MyCustomRating rating, AdaptiveRenderContext context)
36 | {
37 | var textBlock = new AdaptiveTextBlock
38 | {
39 | Size = rating.Size,
40 | Color = rating.Color
41 | };
42 | for (int i = 0; i < rating.Rating; i++)
43 | {
44 | textBlock.Text += "\u2605";
45 | }
46 | textBlock.Text += $" ({rating.Rating})";
47 | return context.Render(textBlock);
48 | }
49 | }
50 | ```
51 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-html/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: .NET HTML SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 01/04/2021
6 | ms.topic: article
7 | ---
8 |
9 | # Getting started - .NET HTML
10 |
11 | As we described in [Getting Started](../../../authoring-cards/getting-started.md) page, an Adaptive Card is a JSON-serialized card object model. This is a .NET library for generating HTML markup, typically from a server.
12 |
13 | > [!IMPORTANT]
14 | >
15 | > **As of 12/31/2020 this package is in Maintenance mode and no longer in active development**. It will only receive critical bugs and security fixes. Please see our [Support policy](/lifecycle/end-of-support/end-of-support-2020) for more details. If you are interested in maintaining this project we would be happy to provide support where possible -- please reach out on GitHub and let us know.
16 |
17 | ## NuGet install
18 |
19 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Html)
20 |
21 | ```console
22 | Install-Package AdaptiveCards.Rendering.Html -IncludePrerelease
23 | ```
24 |
25 | ## Next steps
26 |
27 | See [Render a card](render-a-card.md) for the next steps!
28 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-html/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - .NET HTML SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Host config - .NET HTML
10 |
11 | A [Host Config](../../../rendering-cards/host-config.md) is a shared configuration object that all renderers understand. This allows you to define common styles (e.g., font family, font sizes, default spacing) and behaviors (e.g., max number of actions) that will be automatically interpreted by each platform renderer.
12 |
13 | The goal is that the native UI generated by each platform renderer will look very similar with minimal work on your part.
14 |
15 | ```csharp
16 | // Construct programmatically
17 | renderer.HostConfig = new AdaptiveHostConfig()
18 | {
19 | FontFamily = "Comic Sans",
20 | FontSizes = {
21 | Small = 15,
22 | Default = 20,
23 | Medium = 25,
24 | Large = 30,
25 | ExtraLarge= 40
26 | }
27 | };
28 |
29 | // Or parse from JSON
30 | renderer.HostConfig = AdaptiveHostConfig.FromJson(@"{
31 | ""fontFamily"": ""Comic Sans"",
32 | ""fontSizes"": {
33 | ""small"": 25,
34 | ""default"": 26,
35 | ""medium"": 27,
36 | ""large"": 28,
37 | ""extraLarge"": 29
38 | }
39 | }");
40 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-html/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - .NET HTML SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Native styling - .NET HTML
10 |
11 | While Host Config will get you most of the way there on each platform, it's likely that you will have to do some native styling on each platform.
12 |
13 | HTML makes this easy by adding CSS classes to every element.
14 |
15 | | Element | CSS class |
16 | |---|---|
17 | | AdaptiveCard | ac-adaptivecard |
18 | | All Actions | ac-pushButton |
19 | | Select Actions | ac-selectable |
20 | | Action.OpenUrl | ac-action-openUrl |
21 | | Action.ShowCard | ac-action-showCard |
22 | | Action.Submit | ac-action-submit |
23 | | ActionSet | ac-actionset |
24 | | Column | ac-column |
25 | | ColumnSet | ac-columnset |
26 | | Container | ac-container |
27 | | All Inputs | ac-input |
28 | | Input.ChoiceSet | ac-multichoiceInput |
29 | | Input.Date | ac-dateInput |
30 | | Input.Number | ac-numberInput |
31 | | Input.Text | ac-textInput |
32 | | Input.Time | ac-timeInput |
33 | | Input.Toggle| - |
34 | | Image | ac-image |
35 | | ImageSet | ac-imageset |
36 | | FactSet | ac-factset |
37 | | TextBlock | ac-textblock |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-html/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - .NET HTML SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Render a card - .NET HTML
10 |
11 | Here's how to render a card using the .NET HTML SDK.
12 |
13 | ## Instantiate a renderer
14 |
15 | The next step is to create an instance of the renderer.
16 |
17 | ```csharp
18 | using AdaptiveCards;
19 | using AdaptiveCards.Rendering;
20 | using AdaptiveCards.Rendering.Html;
21 | // ...
22 |
23 | // Create a card renderer
24 | AdaptiveCardRenderer renderer = new AdaptiveCardRenderer();
25 |
26 | // For fun, check the schema version this renderer supports
27 | AdaptiveSchemaVersion schemaVersion = renderer.SupportedSchemaVersion; // 1.0
28 | ```
29 |
30 | ## Render a card to HTML
31 |
32 | ```csharp
33 | // Build a simple card
34 | // In the real world this would probably be provided as JSON
35 | AdaptiveCard card = new AdaptiveCard(renderer.SupportedSchemaVersion)
36 | {
37 | Body = { new AdaptiveTextBlock() { Text = "Hello World" } }
38 | };
39 |
40 | try
41 | {
42 | // Render the card
43 | RenderedAdaptiveCard renderedCard = renderer.RenderCard(card);
44 |
45 | // Get the output HTML
46 | HtmlTag html = renderedCard.Html;
47 |
48 | // (Optional) Check for any renderer warnings
49 | // This includes things like an unknown element type found in the card
50 | // Or the card exceeded the maximum number of supported actions, etc
51 | IList warnings = renderedCard.Warnings;
52 | }
53 | catch(AdaptiveException ex)
54 | {
55 | // Failed rendering
56 | }
57 | ```
58 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/actions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Actions - .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Actions - .NET Image
10 |
11 | Actions are unsupported, considering this renders to an image.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/extensibility.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Extensibility - .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Extensibility - .NET Image
10 |
11 | See the [WPF docs](../net-wpf/getting-started.md) for a full run-down of these options.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Getting started - .NET Image
10 |
11 | As we described in [Getting Started](../../../authoring-cards/getting-started.md) page, an Adaptive Card is a JSON-serialized card object model. This library makes it easy to render that JSON into into a PNG image.
12 |
13 | This package can even be used on a server to generate images, and implements all the "magic STA thread" goo for you.
14 |
15 | ## NuGet install
16 |
17 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Wpf)
18 |
19 | ```console
20 | Install-Package AdaptiveCards.Rendering.Wpf -IncludePrerelease
21 | ```
22 |
23 | ## Next steps
24 |
25 | See [Render a card](render-a-card.md) for the next steps!
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Host config - .NET Image
10 |
11 | See the [WPF docs](../net-wpf/getting-started.md) for a full run-down of these options.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Native styling - .NET Image
10 |
11 | See the [WPF docs](../net-wpf/getting-started.md) for a full run-down of these options.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-image/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - .NET Image Rendering SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Render a card - .NET Image
10 |
11 | Here's how to render a card using the .NET Image SDK.
12 |
13 | ```csharp
14 | try
15 | {
16 | // A URL that returns an Adaptive Card JSON payload
17 | var cardUrl = "http://adaptivecards.io/payloads/ActivityUpdate.json";
18 |
19 | // Timeout after 30 seconds
20 | var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
21 |
22 | // Get the JSON from the card URL
23 | var client = new HttpClient();
24 | var response = await client.GetAsync(cardUrl, cts.Token);
25 | var json = await response.Content.ReadAsStringAsync();
26 |
27 | // Parse the Adaptive Card JSON
28 | AdaptiveCardParseResult parseResult = AdaptiveCard.FromJson(json);
29 | AdaptiveCard card = parseResult.Card;
30 |
31 | // Create a host config with no interactivity
32 | // (buttons in images would be deceiving)
33 | AdaptiveHostConfig hostConfig = new AdaptiveHostConfig()
34 | {
35 | SupportsInteractivity = false
36 | };
37 |
38 | // Create a renderer
39 | AdaptiveCardRenderer renderer = new AdaptiveCardRenderer(hostConfig);
40 |
41 | // Set any XAML resource Dictionary if you have one
42 | //renderer.ResourcesPath = ;
43 |
44 | // Render the card to png
45 | // Set createStaThread to true if running from a server
46 | RenderedAdaptiveCardImage renderedCard =
47 | await renderer.RenderCardToImageAsync(card, createStaThread: true, cancellationToken: cts.Token);
48 | }
49 | catch (OperationCanceledException)
50 | {
51 | // Timed out
52 | }
53 | catch (Exception ex)
54 | {
55 | // Log failure
56 | }
57 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/actions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Actions - .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Actions - .NET WPF
10 |
11 | Any `actions` within the card will render as WPF `Button`s, but it's up to your app to handle what happens when a user presses them.
12 |
13 | The `RenderedAdaptiveCard` object provides an `OnAction` event for this purpose.
14 |
15 | ```csharp
16 | // Event handler fires when a user clicks an action within the card
17 | renderedCard.OnAction += MyActionHandler;
18 |
19 | private void MyActionHandler(RenderedAdaptiveCard sender, AdaptiveActionEventArgs e)
20 | {
21 | if (e.Action is AdaptiveOpenUrlAction openUrlAction)
22 | {
23 | Process.Start(openUrlAction.Url.AbsoluteUri);
24 | }
25 | else if (e.Action is AdaptiveShowCardAction showCardAction)
26 | {
27 | // Action.ShowCard can be rendered inline automatically
28 | // ... but if you want to handle show card as a "popup", you handle this event
29 | if (_myHostConfig.Actions.ShowCard.ActionMode == ShowCardActionMode.Popup)
30 | {
31 | var dialog = new ShowCardWindow(showCardAction.Title, showCardAction, Resources);
32 | dialog.Owner = this;
33 | dialog.ShowDialog();
34 | }
35 | }
36 | else if (e.Action is AdaptiveSubmitAction submitAction)
37 | {
38 | var inputs = sender.UserInputs.AsJson();
39 | inputs.Merge(submitAction.Data);
40 | MessageBox.Show(this, JsonConvert.SerializeObject(inputs, Formatting.Indented), "SubmitAction");
41 | }
42 | }
43 | ```
44 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/extensibility.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Extensibility - .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Extensibility - .NET WPF
10 |
11 | ## Custom Element Rendering
12 |
13 | For full control of the renderer you can use the `ElementRenderers` property to **add**, **remove**, or **override** default renderers.
14 |
15 | The following example shows how you could define a custom `"type": "Rating"` element and render it.
16 |
17 | ```csharp
18 | // Register the new type with the JSON parser
19 | AdaptiveTypedElementConverter.RegisterTypedElement();
20 |
21 | // Add the new type to the element renderer registry
22 | renderer.ElementRenderers.Set(MyCustomRating.Render);
23 |
24 | // Define a custom Rating element type
25 | public class MyCustomRating : AdaptiveElement
26 | {
27 | public MyCustomRating() { Type = "Rating"; }
28 |
29 | public override string Type { get; set; }
30 |
31 | public AdaptiveTextSize Size { get; set; }
32 |
33 | public AdaptiveTextColor Color { get; set; }
34 |
35 | public static FrameworkElement Render(MyCustomRating rating, AdaptiveRenderContext context)
36 | {
37 | var textBlock = new AdaptiveTextBlock
38 | {
39 | Size = rating.Size,
40 | Color = rating.Color
41 | };
42 | for (int i = 0; i < rating.Rating; i++)
43 | {
44 | textBlock.Text += "\u2605";
45 | }
46 | textBlock.Text += $" ({rating.Rating})";
47 | return context.Render(textBlock);
48 | }
49 | }
50 | ```
51 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Getting started - .NET WPF
10 |
11 | As we described in [Getting Started](../../../authoring-cards/getting-started.md) page, an Adaptive Card is a JSON-serialized card object model. This library makes it easy to render that JSON into WPF UI that you can use within your app.
12 |
13 | ## NuGet install
14 |
15 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Wpf)
16 |
17 | ```console
18 | Install-Package AdaptiveCards.Rendering.Wpf
19 | ```
20 |
21 | ### Xceed enhanced input package
22 |
23 | This optional package enhances the Adaptive Card Input controls beyond what WPF provides out of the box. It has a dependency on `Extended.Wpf.Toolkit`
24 |
25 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Wpf.Xceed)
26 |
27 | ```console
28 | Install-Package AdaptiveCards.Rendering.Wpf.Xceed
29 | ```
30 |
31 | ## WPF Visualizer Sample
32 |
33 | 
34 |
35 | The [WPF Visualizer sample](https://github.com/Microsoft/AdaptiveCards/tree/master/source/dotnet/Samples/WPFVisualizer) lets you visualize cards using WPF. A `Host Config` editor is built in for editing and viewing host config settings. Save these settings as a JSON to use them in rendering in your application.
36 |
37 | ## Next steps
38 |
39 | See [Render a card](render-a-card.md) for the next steps!
40 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Host config - .NET WPF
10 |
11 | A [Host Config](../../../rendering-cards/host-config.md) is a shared configuration object that all renderers understand. This allows you to define common styles (e.g., font family, font sizes, default spacing) and behaviors (e.g., max number of actions) that will be automatically interpreted by each platform renderer.
12 |
13 | The goal is that the native UI generated by each platform renderer will look very similar with minimal work on your part.
14 |
15 | ```csharp
16 | // Construct programmatically
17 | renderer.HostConfig = new AdaptiveHostConfig()
18 | {
19 | FontStyles = new FontStylesConfig()
20 | {
21 | Default = new FontStyleConfig()
22 | {
23 | FontFamily = "Consolas",
24 | FontSizes = {
25 | Small = 15,
26 | Default = 20,
27 | Medium = 25,
28 | Large = 30,
29 | ExtraLarge= 40
30 | }
31 | },
32 | }
33 | };
34 |
35 | // Or parse from JSON
36 | renderer.HostConfig = AdaptiveHostConfig.FromJson(@"{
37 | ""fontStyles"": {
38 | ""default"": {
39 | ""fontFamily"": ""Consolas"",
40 | ""fontSizes"": {
41 | ""small"": 15,
42 | ""default"": 20,
43 | ""medium"": 25,
44 | ""large"": 30,
45 | ""extraLarge"": 40
46 | }
47 | }
48 | }}");
49 | ```
50 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Native styling - .NET WPF
10 |
11 | While Host Config will get you most of the way there on each platform, it's likely that you will have to do some native styling on each platform.
12 |
13 | WPF makes this easy by allowing you to pass a ResourceDictionary for fine-grained styling, behavior, animations, etc.
14 |
15 | | Element | Style names |
16 | |---|---|
17 | | AdaptiveCard | Adaptive.Card|
18 | | Action.OpenUrl | Adaptive.Action.OpenUrl |
19 | | Action.ShowCard | Adaptive.Action.ShowCard |
20 | | Action.Submit | Adaptive.Action.Submit |
21 | | Column | Adaptive.Column, Adaptive.Action.Tap |
22 | | ColumnSet | Adaptive.ColumnSet, Adaptive.VerticalSeparator |
23 | | Container | Adaptive.Container|
24 | | Input.ChoiceSet | Adaptive.Input.ChoiceSet, Adaptive.Input.ChoiceSet.ComboBox, Adaptive.Input.ChoiceSet.CheckBox, Adaptive.Input.ChoiceSet.Radio, Adaptive.Input.ChoiceSet.ComboBoxItem |
25 | | Input.Date | Adaptive.Input.Text.Date
26 | | Input.Number | Adaptive.Input.Text.Number |
27 | | Input.Text | Adaptive.Input.Text |
28 | | Input.Time | Adaptive.Input.Text.Time |
29 | | Input.Toggle| Adaptive.Input.Toggle|
30 | | Image | Adaptive.Image |
31 | | ImageSet | Adaptive.ImageSet |
32 | | FactSet | Adaptive.FactSet, Adaptive.Fact.Title, Adaptive.Fact.Value |
33 | | TextBlock | Adaptive.TextBlock |
34 |
35 | This sample XAML Resource dictionary that sets the background of all TextBlocks to Aqua. You will probably want something more advanced than this 😁
36 |
37 | ```xml
38 |
41 |
44 |
45 | ```
46 | ```csharp
47 | // Use a ResourceDictionary instance
48 | // DON'T use this property if rendering from a server
49 | renderer.Resources = myResourceDictionary;
50 |
51 | // ... or load it from a file path
52 | // USE this if rendering from a server
53 | renderer.ResourcesPath = ;
54 | ```
55 |
56 | > [!IMPORTANT]
57 | > **A note about server-side image generation**
58 | > The WPF renderer provides a `RenderCardToImageAsync` method that can be used for server-side image generation.
59 | > You must only use the `ResourcesPath` property if used in this environment.
60 | > See the [Image Rendering](../net-image/getting-started.md) docs for more
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/net-wpf/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - .NET WPF SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 10/19/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Render a card - .NET WPF
10 |
11 | Here's how to render a card using the .NET WPF SDK.
12 |
13 | > [!NOTE]
14 | > **`Media` with HTTPS URLs will not work in WPF**
15 | >
16 | > Due to a [bug in the WPF MediaElement control](https://stackoverflow.com/questions/30702505/playing-media-from-https-site-in-media-element-throwing-null-reference-exception) we aren't able to render media that is served via HTTPS. You should use HTTP URLs in the `Media` element until this is addressed.
17 |
18 | ## Instantiate a renderer
19 |
20 | Create an instance of the renderer library.
21 |
22 | ```csharp
23 | using AdaptiveCards;
24 | using AdaptiveCards.Rendering;
25 | using AdaptiveCards.Rendering.Wpf;
26 | // ...
27 |
28 | // Create a card renderer
29 | AdaptiveCardRenderer renderer = new AdaptiveCardRenderer();
30 |
31 | // If using the Xceed package, enable the enhanced input
32 | renderer.UseXceedElementRenderers();
33 |
34 | // For fun, check the schema version this renderer supports
35 | AdaptiveSchemaVersion schemaVersion = renderer.SupportedSchemaVersion;
36 | ```
37 |
38 | ## Render a card to XAML
39 |
40 | ```csharp
41 | // Build a simple card
42 | // In the real world this would probably be provided as JSON
43 | AdaptiveCard card = new AdaptiveCard("1.0")
44 | {
45 | Body = { new AdaptiveTextBlock() { Text = "Hello World" } }
46 | };
47 |
48 | try
49 | {
50 | // Render the card
51 | RenderedAdaptiveCard renderedCard = renderer.RenderCard(card);
52 |
53 | // Get the FrameworkElement
54 | // Add this to your app's UI somewhere
55 | FrameworkElement fe = renderedCard.FrameworkElement;
56 |
57 | // (Optional) Check for any renderer warnings
58 | // This includes things like an unknown element type found in the card
59 | // Or the card exceeded the maximum number of supported actions, etc
60 | IList warnings = renderedCard.Warnings;
61 | }
62 | catch(AdaptiveException ex)
63 | {
64 | // Failed rendering
65 | }
66 | ```
67 |
68 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/react-native/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: ReactNative SDK
3 | description: Adaptive Card rendering SDK for ReactNative
4 | author: matthidinger
5 | ms.author: mahiding
6 | ms.date: 08/03/2022
7 | ms.topic: article
8 | ---
9 |
10 | # ReactNative Renderer
11 |
12 | A [community-supported](https://github.com/microsoft/AdaptiveCards/blob/main/SUPPORT.md) ReactNative renderer for Adaptive Cards, maintained by [BigThinkCode](https://www.bigthinkcode.com).
13 |
14 | > [!IMPORTANT]
15 | >
16 | > **Community Support Only**. This renderer is in active development but is maintained outside of Microsoft. **As such, we cannot guarantee any SLA for this SDK**. Please see our [Support policy](https://github.com/microsoft/AdaptiveCards/blob/main/SUPPORT.md) for more details.
17 | >
18 |
19 | ## Getting started
20 |
21 | ### Install the package
22 |
23 | `npm install adaptivecards-reactnative`
24 |
25 | ### Import the root component
26 |
27 | `import AdaptiveCard from 'adaptivecards-reactnative'`
28 |
29 | ### Render the component with required props
30 |
31 | ```jsx
32 |
49 | ```
50 |
51 | ## Full documentation and source code
52 |
53 | * [Documentation](https://www.npmjs.com/package/adaptivecards-reactnative)
54 | * [Source code](https://github.com/BigThinkcode/AdaptiveCards/tree/master/source/community/reactnative)
55 |
56 | ## Customization and Themeing
57 |
58 | To customize the rendering, please see the [theme config](./theme-config.md) documentation.
59 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Android
2 | items:
3 | - name: Getting Started
4 | href: android/getting-started.md
5 | - name: Render a Card
6 | href: android/render-a-card.md
7 | - name: Actions
8 | href: android/actions.md
9 | - name: Host Config
10 | href: android/host-config.md
11 | - name: Native Styling
12 | href: android/native-styling.md
13 | - name: Extensibility
14 | href: android/extensibility.md
15 | - name: iOS
16 | items:
17 | - name: Getting Started
18 | href: ios/getting-started.md
19 | - name: Render a Card
20 | href: ios/render-a-card.md
21 | - name: Actions
22 | href: ios/actions.md
23 | - name: Host Config
24 | href: ios/host-config.md
25 | - name: Native Styling
26 | href: ios/native-styling.md
27 | - name: Extensibility
28 | href: ios/extensibility.md
29 | - name: JavaScript
30 | items:
31 | - name: Getting Started
32 | href: javascript/getting-started.md
33 | - name: Render a Card
34 | href: javascript/render-a-card.md
35 | - name: Actions
36 | href: javascript/actions.md
37 | - name: Host Config
38 | href: javascript/host-config.md
39 | - name: Native Styling
40 | href: javascript/native-styling.md
41 | - name: Extensibility
42 | href: javascript/extensibility.md
43 | - name: Fabric UI integration
44 | href: javascript/fabric.md
45 | - name: .NET HTML
46 | items:
47 | - name: Getting Started
48 | href: net-html/getting-started.md
49 | - name: Render a Card
50 | href: net-html/render-a-card.md
51 | - name: Actions
52 | href: net-html/actions.md
53 | - name: Host Config
54 | href: net-html/host-config.md
55 | - name: Native Styling
56 | href: net-html/native-styling.md
57 | - name: Extensibility
58 | href: net-html/extensibility.md
59 | - name: .NET WPF
60 | items:
61 | - name: Getting Started
62 | href: net-wpf/getting-started.md
63 | - name: Render a Card
64 | href: net-wpf/render-a-card.md
65 | - name: Actions
66 | href: net-wpf/actions.md
67 | - name: Host Config
68 | href: net-wpf/host-config.md
69 | - name: Native Styling
70 | href: net-wpf/native-styling.md
71 | - name: Extensibility
72 | href: net-wpf/extensibility.md
73 | - name: .NET Image
74 | items:
75 | - name: Getting Started
76 | href: net-image/getting-started.md
77 | - name: Render a Card
78 | href: net-image/render-a-card.md
79 | - name: Actions
80 | href: net-image/actions.md
81 | - name: Host Config
82 | href: net-image/host-config.md
83 | - name: Native Styling
84 | href: net-image/native-styling.md
85 | - name: Extensibility
86 | href: net-image/extensibility.md
87 | - name: UWP
88 | items:
89 | - name: Getting Started
90 | href: uwp/getting-started.md
91 | - name: Render a Card
92 | href: uwp/render-a-card.md
93 | - name: Actions
94 | href: uwp/actions.md
95 | - name: Host Config
96 | href: uwp/host-config.md
97 | - name: Native Styling
98 | href: uwp/native-styling.md
99 | - name: Extensibility
100 | href: uwp/extensibility.md
101 | - name: WinUI 3
102 | items:
103 | - name: Getting Started
104 | href: winui-3/getting-started.md
105 | - name: Render a Card
106 | href: winui-3/render-a-card.md
107 | - name: Actions
108 | href: winui-3/actions.md
109 | - name: Host Config
110 | href: winui-3/host-config.md
111 | - name: Native Styling
112 | href: winui-3/native-styling.md
113 | - name: Extensibility
114 | href: winui-3/extensibility.md
115 | - name: ReactNative
116 | items:
117 | - name: Getting Started
118 | href: react-native/getting-started.md
119 | - name: Customization and themeing
120 | href: react-native/theme-config.md
121 | - name: Xamarin.Android
122 | items:
123 | - name: Getting Started
124 | href: xamarin/android/getting-started.md
125 | - name: Render a Card
126 | href: xamarin/android/render-a-card.md
127 | - name: Actions
128 | href: xamarin/android/actions.md
129 | - name: Host Config
130 | href: xamarin/android/host-config.md
131 | - name: Native Styling
132 | href: xamarin/android/native-styling.md
133 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/actions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Actions - UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 06/26/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Actions - UWP
10 |
11 | Any **actions** within the card will render as UWP **Button**'s, but it's up to your app to handle what happens when a user presses them (except for ShowCard actions... see code snippet for more info).
12 |
13 | The `RenderedAdaptiveCard` object provides an `Action` event for this purpose.
14 |
15 | ```csharp
16 | // Render a card (as previously shown)
17 | RenderedAdaptiveCard renderedAdaptiveCard = renderer.RenderAdaptiveCard(card);
18 |
19 | // ...
20 |
21 | // Attach the event handler for action click events
22 | renderedAdaptiveCard.Action += RenderedAdaptiveCard_Action;
23 |
24 | private async void RenderedAdaptiveCard_Action(RenderedAdaptiveCard sender, AdaptiveActionEventArgs args)
25 | {
26 | if (args.Action is AdaptiveOpenUrlAction openUrlAction)
27 | {
28 | await Launcher.LaunchUriAsync(openUrlAction.Url);
29 | }
30 |
31 | else if (args.Action is AdaptiveShowCardAction showCardAction)
32 | {
33 | // This is only fired if, in HostConfig, you set the ShowCard ActionMode to Popup.
34 | // Otherwise, the renderer will automatically display the card inline without firing this event.
35 | }
36 |
37 | else if (args.Action is AdaptiveSubmitAction submitAction)
38 | {
39 | // Get the data and inputs
40 | string data = submitAction.DataJson.Stringify();
41 | string inputs = args.Inputs.AsJson().Stringify();
42 |
43 | // Process them as desired
44 | }
45 | }
46 | ```
47 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/extensibility.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Extensibility - UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 06/26/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Extensibility - UWP
10 |
11 | ## Changing per element rendering
12 |
13 | Implement a renderer class and set it in the renderer
14 |
15 | ```csharp
16 | // My custom renderer is going to replace how textblocks should render!
17 | public class MyCustomRenderer : IAdaptiveElementRenderer
18 | {
19 | public UIElement Render(IAdaptiveCardElement element, AdaptiveRenderContext context)
20 | {
21 | var adaptiveTextBlock = element as AdaptiveTextBlock;
22 | TextBlock textblock = new TextBlock()
23 | {
24 | Text = adaptiveTextBlock.Text + "I want every single textblock to append this text, and it should be aligned to the right!",
25 | HorizontalAlignment = HorizontalAlignment.Right
26 | };
27 |
28 | return textblock;
29 | }
30 | }
31 |
32 | renderer.ElementRenderers.Set("TextBlock", new MyCustomRenderer());
33 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 06/26/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Getting started - UWP
10 |
11 | This is a renderer which targets UWP native controls.
12 |
13 | ## Install NuGet package
14 |
15 | **AdaptiveCards.Rendering.Uwp**
16 |
17 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Uwp)
18 |
19 | ```console
20 | Install-Package AdaptiveCards.Rendering.Uwp
21 | ```
22 |
23 | ## Namespace
24 |
25 | Declare the renderer namespace.
26 |
27 | ```csharp
28 | using AdaptiveCards.Rendering.Uwp;
29 | ```
30 |
31 | ## Next steps
32 |
33 | See [Render a card](render-a-card.md) for the next steps!
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 06/26/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Host config - UWP
10 |
11 | To customize the renderer you provide an instance of the HostConfig object. (See [Host Config Schema](../../../rendering-cards/host-config.md) for the full description.)
12 |
13 | > The HostConfig object will be instantiated with defaults, so you can set just the properties you want to change.
14 |
15 | Example:
16 |
17 | ```csharp
18 | var hostConfig = new AdaptiveHostConfig()
19 | {
20 | FontSizes = {
21 | Small = 15,
22 | Normal = 20,
23 | Medium = 25,
24 | Large = 30,
25 | ExtraLarge= 40
26 | }
27 | };
28 | renderer.HostConfig = hostConfig;
29 | ```
30 |
31 | > Alternatively, you can load the HostConfig from a JSON string.
32 |
33 | Example:
34 |
35 | ```csharp
36 | var hostConfig = AdaptiveHostConfig.FromJsonString(jsonString);
37 |
38 | renderer.HostConfig = hostConfig;
39 | ```
40 |
41 | When you pass it in to the UWPRenderer you are setting the default HostConfig to use for every card you render.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 08/15/2018
6 | ms.topic: article
7 | ---
8 |
9 | # Native styling - UWP
10 |
11 | While Host Config will get you most of the way there on each platform, it's likely that you will have to do some native styling on each platform.
12 |
13 | UWP makes this easy by allowing you to pass a ResourceDictionary for fine-grained styling, behavior, animations, etc.
14 |
15 | | Element | Style names |
16 | |---|---|
17 | | AdaptiveCard | Adaptive.Card|
18 | | Action.OpenUrl | Adaptive.Action.OpenUrl |
19 | | Action.ShowCard | Adaptive.Action.ShowCard |
20 | | Action.Submit | Adaptive.Action.Submit |
21 | | Column | Adaptive.Column, Adaptive.Action.Tap |
22 | | ColumnSet | Adaptive.ColumnSet, Adaptive.VerticalSeparator |
23 | | Container | Adaptive.Container|
24 | | Input.ChoiceSet | Adaptive.Input.ChoiceSet, Adaptive.Input.ChoiceSet.ComboBox, Adaptive.Input.ChoiceSet.CheckBox, Adaptive.Input.ChoiceSet.Radio, Adaptive.Input.ChoiceSet.ComboBoxItem |
25 | | Input.Date | Adaptive.Input.Text.Date
26 | | Input.Number | Adaptive.Input.Text.Number |
27 | | Input.Text | Adaptive.Input.Text |
28 | | Input.Time | Adaptive.Input.Text.Time |
29 | | Input.Toggle| Adaptive.Input.Toggle|
30 | | Image | Adaptive.Image |
31 | | ImageSet | Adaptive.ImageSet |
32 | | FactSet | Adaptive.FactSet, Adaptive.Fact.Title, Adaptive.Fact.Value |
33 | | TextBlock | Adaptive.TextBlock |
34 |
35 | This sample XAML Resource dictionary that sets the background of all TextBlocks to Aqua. You will probably want something more advanced than this 😁
36 |
37 | ```xml
38 |
41 |
44 |
45 | ```
46 | ```csharp
47 | // Use a ResourceDictionary instance
48 | // DON'T use this property if rendering from a server
49 | renderer.Resources = myResourceDictionary;
50 | ```
51 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/uwp/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - UWP SDK
3 | author: matthidinger
4 | ms.author: mahiding
5 | ms.date: 06/26/2017
6 | ms.topic: article
7 | ---
8 |
9 | # Render a card - UWP
10 |
11 | Here's how to render a card using the UWP SDK.
12 |
13 | ## Create an instance of your renderer
14 |
15 | Create an instance of the renderer library.
16 |
17 | ```csharp
18 | using AdaptiveCards.Rendering.Uwp;
19 | // ...
20 |
21 | var renderer = new AdaptiveCardRenderer();
22 | ```
23 |
24 | ## Create a card from a JSON string
25 |
26 | ```csharp
27 | var card = AdaptiveCard.FromJsonString(jsonString);
28 | ```
29 |
30 | ## Create a card from a JSON object
31 |
32 | ```csharp
33 | var card = AdaptiveCard.FromJson(jsonObject);
34 | ```
35 |
36 | ## Render a card
37 |
38 | Acquire a card from a source and render it.
39 |
40 | ```csharp
41 | RenderedAdaptiveCard renderedAdaptiveCard = renderer.RenderAdaptiveCard(card);
42 |
43 | // Check if the render was successful
44 | if (renderedAdaptiveCard.FrameworkElement != null)
45 | {
46 | // Get the framework element
47 | var uiCard = renderedAdaptiveCard.FrameworkElement;
48 |
49 | // Add it to your UI
50 | myGrid.Children.Add(uiCard);
51 | }
52 | ```
53 |
54 | ## Example
55 |
56 | Here is an example from the UWP renderer.
57 |
58 | ```csharp
59 | var renderer = new AdaptiveCardRenderer();
60 | var card = AdaptiveCard.FromJsonString(jsonString);
61 | var renderedAdaptiveCard = renderer.RenderAdaptiveCard(card.AdaptiveCard);
62 | if (renderedAdaptiveCard.FrameworkElement != null)
63 | {
64 | myGrid.Children.Add(renderedAdaptiveCard.FrameworkElement);
65 | }
66 | ...
67 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/actions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Actions - WinUI 3 SDK
3 | description: This article walks you through how to implement Actions in Adaptive Cards using the WinUI 3 SDK.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Actions - WinUI 3
11 |
12 | Any **actions** within the card will render as WinUI 3 **Button**'s, but it's up to your app to handle what happens when a user presses them (except for ShowCard actions... see code snippet for more info).
13 |
14 | The `RenderedAdaptiveCard` object provides an `Action` event for this purpose.
15 |
16 | ```csharp
17 | // Render a card (as previously shown)
18 | RenderedAdaptiveCard renderedAdaptiveCard = renderer.RenderAdaptiveCard(card);
19 |
20 | // ...
21 |
22 | // Attach the event handler for action click events
23 | renderedAdaptiveCard.Action += RenderedAdaptiveCard_Action;
24 |
25 | private async void RenderedAdaptiveCard_Action(RenderedAdaptiveCard sender, AdaptiveActionEventArgs args)
26 | {
27 | if (args.Action is AdaptiveOpenUrlAction openUrlAction)
28 | {
29 | await Launcher.LaunchUriAsync(openUrlAction.Url);
30 | }
31 |
32 | else if (args.Action is AdaptiveShowCardAction showCardAction)
33 | {
34 | // This is only fired if, in HostConfig, you set the ShowCard ActionMode to Popup.
35 | // Otherwise, the renderer will automatically display the card inline without firing this event.
36 | }
37 |
38 | else if (args.Action is AdaptiveSubmitAction submitAction)
39 | {
40 | // Get the data and inputs
41 | string data = submitAction.DataJson.Stringify();
42 | string inputs = args.Inputs.AsJson().Stringify();
43 |
44 | // Process them as desired
45 | }
46 | }
47 | ```
48 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/extensibility.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Extensibility - WinUI 3 SDK
3 | description: This article walks you through the process of using extensibility in the WinUI 3 SDK.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Extensibility - WinUI 3
11 |
12 | ## Changing per element rendering
13 |
14 | Implement a renderer class and set it in the renderer
15 |
16 | ```csharp
17 | // My custom renderer is going to replace how textblocks should render!
18 | public class MyCustomRenderer : IAdaptiveElementRenderer
19 | {
20 | public UIElement Render(IAdaptiveCardElement element, AdaptiveRenderContext context)
21 | {
22 | var adaptiveTextBlock = element as AdaptiveTextBlock;
23 | TextBlock textblock = new TextBlock()
24 | {
25 | Text = adaptiveTextBlock.Text + "I want every single textblock to append this text, and it should be aligned to the right!",
26 | HorizontalAlignment = HorizontalAlignment.Right
27 | };
28 |
29 | return textblock;
30 | }
31 | }
32 |
33 | renderer.ElementRenderers.Set("TextBlock", new MyCustomRenderer());
34 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: WinUI 3 SDK
3 | description: This article walks you through the process of installing the WinUI 3 SDK for Adaptive Cards.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Getting started - WinUI 3
11 |
12 | This is a renderer which targets WinUI 3 native controls.
13 |
14 | ## Install NuGet package
15 |
16 | **AdaptiveCards.Rendering.WinUI3**
17 |
18 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Winui3)
19 |
20 | ```console
21 | Install-Package AdaptiveCards.Rendering.WinUI3
22 | ```
23 |
24 | ## Namespace
25 |
26 | Declare the renderer namespace.
27 |
28 | ```csharp
29 | using AdaptiveCards.Rendering.WinUI3;
30 | ```
31 |
32 | ## Next steps
33 |
34 | See [Render a card](render-a-card.md) for the next steps!
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - WinUI 3 SDK
3 | description: This article walks you through the process of customizing the Host Config using the WinUI 3 SDK.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Host config - WinUI 3
11 |
12 | To customize the renderer you provide an instance of the HostConfig object. (See [Host Config Schema](../../../rendering-cards/host-config.md) for the full description.)
13 |
14 | > The HostConfig object will be instantiated with defaults, so you can set just the properties you want to change.
15 |
16 | Example:
17 |
18 | ```csharp
19 | var hostConfig = new AdaptiveHostConfig()
20 | {
21 | FontSizes = {
22 | Small = 15,
23 | Normal = 20,
24 | Medium = 25,
25 | Large = 30,
26 | ExtraLarge= 40
27 | }
28 | };
29 | renderer.HostConfig = hostConfig;
30 | ```
31 |
32 | > Alternatively, you can load the HostConfig from a JSON string.
33 |
34 | Example:
35 |
36 | ```csharp
37 | var hostConfig = AdaptiveHostConfig.FromJsonString(jsonString);
38 |
39 | renderer.HostConfig = hostConfig;
40 | ```
41 |
42 | When you pass it in to the WinUI3 Renderer you are setting the default HostConfig to use for every card you render.
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - WinUI 3 SDK
3 | description: This article walks you through the process of implementing native styling using the WinUI 3 SDK.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Native styling - WinUI 3
11 |
12 | While Host Config will get you most of the way there on each platform, it's likely that you will have to do some native styling on each platform.
13 |
14 | WinUI 3 makes this easy by allowing you to pass a ResourceDictionary for fine-grained styling, behavior, animations, etc.
15 |
16 | | Element | Style names |
17 | |---|---|
18 | | AdaptiveCard | Adaptive.Card|
19 | | Action.OpenUrl | Adaptive.Action.OpenUrl |
20 | | Action.ShowCard | Adaptive.Action.ShowCard |
21 | | Action.Submit | Adaptive.Action.Submit |
22 | | Column | Adaptive.Column, Adaptive.Action.Tap |
23 | | ColumnSet | Adaptive.ColumnSet, Adaptive.VerticalSeparator |
24 | | Container | Adaptive.Container|
25 | | Input.ChoiceSet | Adaptive.Input.ChoiceSet, Adaptive.Input.ChoiceSet.ComboBox, Adaptive.Input.ChoiceSet.CheckBox, Adaptive.Input.ChoiceSet.Radio, Adaptive.Input.ChoiceSet.ComboBoxItem |
26 | | Input.Date | Adaptive.Input.Text.Date
27 | | Input.Number | Adaptive.Input.Text.Number |
28 | | Input.Text | Adaptive.Input.Text |
29 | | Input.Time | Adaptive.Input.Text.Time |
30 | | Input.Toggle| Adaptive.Input.Toggle|
31 | | Image | Adaptive.Image |
32 | | ImageSet | Adaptive.ImageSet |
33 | | FactSet | Adaptive.FactSet, Adaptive.Fact.Title, Adaptive.Fact.Value |
34 | | TextBlock | Adaptive.TextBlock |
35 |
36 | This sample XAML Resource dictionary that sets the background of all TextBlocks to Aqua. You will probably want something more advanced than this 😁
37 |
38 | ```xml
39 |
42 |
45 |
46 | ```
47 | ```csharp
48 | // Use a ResourceDictionary instance
49 | // DON'T use this property if rendering from a server
50 | renderer.Resources = myResourceDictionary;
51 | ```
52 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/winui-3/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - WinUI 3 SDK
3 | description: This article walks you through the process of rendering an Adaptive Card using the WinUI 3 SDK.
4 | author: JeanRoca
5 | ms.author: jproca
6 | ms.date: 05/04/2023
7 | ms.topic: article
8 | ---
9 |
10 | # Render a card - WinUI 3
11 |
12 | Here's how to render a card using the WinUI 3 SDK.
13 |
14 | ## Create an instance of your renderer
15 |
16 | Create an instance of the renderer library.
17 |
18 | ```csharp
19 | using AdaptiveCards.Rendering.WinUI3;
20 | // ...
21 |
22 | var renderer = new AdaptiveCardRenderer();
23 | ```
24 |
25 | ## Create a card from a JSON string
26 |
27 | ```csharp
28 | var card = AdaptiveCard.FromJsonString(jsonString);
29 | ```
30 |
31 | ## Create a card from a JSON object
32 |
33 | ```csharp
34 | var card = AdaptiveCard.FromJson(jsonObject);
35 | ```
36 |
37 | ## Render a card
38 |
39 | Acquire a card from a source and render it.
40 |
41 | ```csharp
42 | RenderedAdaptiveCard renderedAdaptiveCard = renderer.RenderAdaptiveCard(card);
43 |
44 | // Check if the render was successful
45 | if (renderedAdaptiveCard.FrameworkElement != null)
46 | {
47 | // Get the framework element
48 | var uiCard = renderedAdaptiveCard.FrameworkElement;
49 |
50 | // Add it to your UI
51 | myGrid.Children.Add(uiCard);
52 | }
53 | ```
54 |
55 | ## Example
56 |
57 | Here is an example from the WinUI 3 renderer.
58 |
59 | ```csharp
60 | var renderer = new AdaptiveCardRenderer();
61 | var card = AdaptiveCard.FromJsonString(jsonString);
62 | var renderedAdaptiveCard = renderer.RenderAdaptiveCard(card.AdaptiveCard);
63 | if (renderedAdaptiveCard.FrameworkElement != null)
64 | {
65 | myGrid.Children.Add(renderedAdaptiveCard.FrameworkElement);
66 | }
67 | ...
68 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/actions.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Actions - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Actions - Xamarin.Android
10 |
11 | When a cards action is executed, the class that was passed to the render call that implements the [```ICardActionHandler```](adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md) interface gets invoked. Here is how to define your action handler:
12 |
13 | ```csharp
14 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
15 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler;
16 |
17 | // ...
18 |
19 | public class CardActionHandlerImpl : ICardActionHandler
20 | {
21 |
22 | public void OnAction(BaseActionElement element, RenderedAdaptiveCard renderedCard)
23 | {
24 | ActionType actionType = element.ElementType;
25 | if (actionType == ActionType.Submit)
26 | {
27 | var submitAction = SubmitAction.Dynamic_cast(element);
28 | var data = submitAction.DataJson;
29 | Toast.MakeText(this, data + "\n" + inputValues, ToastLength.Short).Show();
30 | }
31 | else if (actionType == ActionType.ShowCard)
32 | {
33 | showCard(card);
34 | }
35 | else if (actionType == ActionType.OpenUrl)
36 | {
37 | openUrl(url);
38 | }
39 | }
40 |
41 | public void OnMediaPlay(BaseCardElement element, RenderedAdaptiveCard renderedCard) { }
42 |
43 | public void OnMediaStop(BaseCardElement element, RenderedAdaptiveCard renderedCard) { }
44 | }
45 | ```
46 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: ICardActionHandler class - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # ICardActionHandler
10 |
11 | ```csharp
12 | public interface ICardActionHandler : IJavaObject
13 | ```
14 |
15 | **Namespace**
16 | ```csharp
17 | namespace AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler
18 | ```
19 |
20 | ### Summary
21 |
22 | | Public methods | |
23 | | --- | ---- |
24 | | ```abstract void``` | [```OnAction (BaseActionElement p0, RenderedAdaptiveCard p1)```](#onaction) |
25 | | ```abstract void``` | [```OnMediaPlay (BaseCardElement p0, RenderedAdaptiveCard p1)```](#onmediaplay) |
26 | | ```abstract void``` | [```OnMediaStop (BaseCardElement p0, RenderedAdaptiveCard p1)```](#onmediastop) |
27 |
28 | ## Public Methods
29 | ---
30 | ### OnAction
31 | Added in version 0.1.0
32 |
33 | ```csharp
34 | void OnAction (BaseActionElement p0, RenderedAdaptiveCard p1)
35 | ```
36 |
37 | Listener called when a OpenUrlAction, SubmitAction or ShowCardAction (if not inline) are clicked.
38 |
39 | | Parameters | |
40 | | --- | --- |
41 | | p0 | ```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.BaseActionElement``` |
42 | | p1 | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md) |
43 |
44 | #### Sample
45 |
46 | ```csharp
47 | public class MyCardActionHandler : ICardActionHandler
48 | {
49 |
50 | public void OnAction(BaseActionElement element, RenderedAdaptiveCard renderedCard)
51 | {
52 | ActionType actionType = element.ElementType;
53 | if (actionType == ActionType.Submit)
54 | {
55 | var inputs = renderedCard.Inputs;
56 | string inputValues = string.Empty;
57 | foreach (var inputString in inputs)
58 | {
59 | inputValues += $"{{{inputString.Key} : {inputString.Value}}}\n";
60 | }
61 | submitData(inputValues);
62 | }
63 | else if (actionType == ActionType.ShowCard)
64 | {
65 | var showcardAction = ShowCardAction.Dynamic_cast(element);
66 | showCard(showcardAction.Card)
67 | }
68 | else if (actionType == ActionType.OpenUrl)
69 | {
70 | var openUrlAction = OpenUrlAction.Dynamic_cast(element);
71 | openUrl(openUrlAction.Url);
72 | }
73 | }
74 | }
75 | ```
76 |
77 | ---
78 | ### OnMediaPlay
79 | Added in version 0.1
80 |
81 | ```csharp
82 | void OnMediaPlay (BaseCardElement p0, RenderedAdaptiveCard p1)
83 | ```
84 |
85 | Listener called when the media element starts playing.
86 |
87 | | Parameters | |
88 | | --- | --- |
89 | | p0 | ```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.BaseCardElement``` |
90 | | p1 | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md) |
91 |
92 | #### Sample
93 |
94 | ```csharp
95 | public class MyCardActionHandler : ICardActionHandler
96 | {
97 | public void OnMediaPlay(BaseCardElement element, RenderedAdaptiveCard renderedCard)
98 | {
99 | }
100 | }
101 | ```
102 |
103 | ---
104 |
105 | ### OnMediaStop
106 | Added in version 0.1
107 |
108 | ```csharp
109 | void OnMediaStop (BaseCardElement p0, RenderedAdaptiveCard p1)
110 | ```
111 |
112 | Listener called when the media element stops playing.
113 |
114 | | Parameters | |
115 | | --- | --- |
116 | | p0 | ```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.BaseCardElement``` |
117 | | p1 | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md) |
118 |
119 | #### Sample
120 |
121 | ```csharp
122 | public class MyCardActionHandler : ICardActionHandler
123 | {
124 | public void OnMediaStop(BaseCardElement element, RenderedAdaptiveCard renderedCard)
125 | {
126 | }
127 | }
128 | ```
129 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/adaptivecards-rendering-xamarin-android-objectmodel-featureregistration.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: FeatureRegistration class - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Feature Registration
10 |
11 | ```csharp
12 | public class FeatureRegistration : Java.Lang.Object
13 | ```
14 |
15 | **Namespace**
16 | ```csharp
17 | namespace AdaptiveCards.Rendering.Xamarin.Android.ObjectModel
18 | ```
19 |
20 | ## Summary
21 |
22 | | Public methods | |
23 | | --- | ---- |
24 | | ```void``` | [```AddFeature(string featureName, string featureVersion)```](#addfeature) |
25 | | ```string``` | [```GetFeatureVersion(string featureName)```](#getfeatureversion) |
26 | | ```void``` | [```RemoveFeature (string featureName)```](#removefeature) |
27 |
28 | ## Public Methods
29 |
30 | ---
31 |
32 | ### AddFeature
33 | Added in version 0.1.0
34 |
35 | ```csharp
36 | public void AddFeature (string featureName,
37 | string featureVersion)
38 | ```
39 |
40 | Adds a feature containing its name and version to the renderer feature registration.
41 |
42 | | Parameters | |
43 | | --- | --- |
44 | | featureName | ```string``` |
45 | | featureVersion | ```string``` |
46 |
47 | #### Sample
48 |
49 | ```csharp
50 | FeatureRegistration featureRegistration = new FeatureRegistration();
51 | featureRegistration.AddFeature("MyFeature", "1.2.0");
52 | CardRendererRegistration.Instance.RegisterFeatureRegistration(featureRegistration);
53 | ```
54 |
55 | ---
56 |
57 | ### GetFeatureVersion
58 | Added in version 0.1.0
59 |
60 | ```csharp
61 | public string GetFeatureVersion (string featureName)
62 | ```
63 |
64 | Retrieves the version for a given feature.
65 |
66 | | Parameters | |
67 | | --- | --- |
68 | | featureName | ```string``` |
69 |
70 | | Returns | |
71 | | --- | --- |
72 | | ```string``` | Feature version for the given feature |
73 |
74 | #### Sample
75 |
76 | ```csharp
77 | FeatureRegistration featureRegistration = new FeatureRegistration();
78 | featureRegistration.AddFeature("MyFeature", "1.2.0");
79 | string featureVersion = featureRegistration.GetFeatureVersion("MyFeature"); // 1.2.0
80 | ```
81 |
82 | ---
83 |
84 | ### RemoveFeature
85 | Added in version 0.1.0
86 |
87 | ```csharp
88 | public void RemoveFeature (string featureName)
89 | ```
90 |
91 | Removes the given feature from the feature dictionary.
92 |
93 | | Parameters | |
94 | | --- | --- |
95 | | featureName | ```string``` |
96 |
97 | #### Sample
98 |
99 | ```csharp
100 | FeatureRegistration featureRegistration = new FeatureRegistration();
101 | featureRegistration.AddFeature("MyFeature", "1.2.0");
102 | featureRegistration.RemoveFeature("MyFeature");
103 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/adaptivecards-rendering-xamarin-android-renderer-adaptivecardrenderer.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: AdaptiveCardRenderer class - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # AdaptiveCardRenderer
10 |
11 | ```csharp
12 | public class AdaptiveCardRenderer : global::Java.Lang.Object
13 | ```
14 |
15 | **Namespace**
16 | ```csharp
17 | namespace AdaptiveCards.Rendering.Xamarin.Android.Renderer
18 | ```
19 |
20 | ### Summary
21 |
22 | | Public methods | |
23 | | --- | ---- |
24 | | ```RenderedAdaptiveCard``` | [```Render (Context context, FragmentManager fragmentManager, AdaptiveCard adaptiveCard, ICardActionHandler cardActionHandler)```](#render0) |
25 | | ```RenderedAdaptiveCard``` | [```Render (Context context, FragmentManager fragmentManager, AdaptiveCard adaptiveCard, ICardActionHandler cardActionHandler, HostConfig hostConfig)```](#render1) |
26 |
27 | ## Public Methods
28 |
29 | ---
30 |
31 | ### Render
32 | Added in version 0.1.0
33 |
34 | ```csharp
35 | public RenderedAdaptiveCard Render (Context context,
36 | FragmentManager fragmentManager,
37 | AdaptiveCard adaptiveCard,
38 | ICardActionHandler cardActionHandler)
39 | ```
40 |
41 | Renders the specified adaptive card with default values for the host config.
42 |
43 | | Parameters | |
44 | | --- | --- |
45 | | context | ```Android.Content.Context``` |
46 | | fragmentManager | ```Android.Support.V4.App.FragmentManager``` |
47 | | adaptiveCard | [```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.AdaptiveCard```](adaptivecards-rendering-xamarin-android-objectmodel-adaptivecard.md) |
48 | | cardActionHandler | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler.ICardActionHandler```](adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md) |
49 |
50 | | Returns | |
51 | | --- | --- |
52 | | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md) | |
53 |
54 | #### Sample
55 |
56 | ```csharp
57 | ParseResult parseResult = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version);
58 | RenderedAdaptiveCard renderedCard = AdaptiveCardRenderer.Instance.Render(context, SupportFragmentManager, parseResult.AdaptiveCard, cardActionHandler);
59 | ```
60 |
61 | ---
62 |
63 | ### Render
64 | Added in version 0.1.0
65 |
66 | ```csharp
67 | RenderedAdaptiveCard Render (Context context,
68 | FragmentManager fragmentManager,
69 | AdaptiveCard adaptiveCard,
70 | ICardActionHandler cardActionHandler,
71 | HostConfig hostConfig)
72 | ```
73 |
74 | Renders the specified adaptive card with using the given host config.
75 |
76 | | Parameters | |
77 | | --- | --- |
78 | | context | ```Android.Content.Context``` |
79 | | fragmentManager | ```Android.Support.V4.App.FragmentManager``` |
80 | | adaptiveCard | [```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.AdaptiveCard```](adaptivecards-rendering-xamarin-android-objectmodel-adaptivecard.md) |
81 | | cardActionHandler | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler.ICardActionHandler```](adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md) |
82 | | hostConfig | ```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.HostConfig``` |
83 |
84 | | Returns | |
85 | | --- | --- |
86 | | [```AdaptiveCards.Rendering.Xamarin.Android.Renderer.RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md) | |
87 |
88 | #### Sample
89 |
90 | ```csharp
91 | ParseResult parseResult = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version);
92 | RenderedAdaptiveCard renderedCard = AdaptiveCardRenderer.Instance.Render(context, SupportFragmentManager, parseResult.AdaptiveCard, cardActionHandler, hostConfig);
93 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/adaptivecards-rendering-xamarin-android-renderer-cardrendererregistration.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: CardRendererRegistration class - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # CardRendererRegistration
10 |
11 | ```csharp
12 | public class CardRendererRegistration : Java.Lang.Object
13 | ```
14 |
15 | **Namespace**
16 | ```csharp
17 | namespace AdaptiveCards.Rendering.Xamarin.Android.Renderer.Registration
18 | ```
19 |
20 | ### Summary
21 |
22 | | Public methods | |
23 | | --- | ---- |
24 | | ```void``` | [```RegisterFeatureRegistration (FeatureRegistration featureRegistration)```](#registerfeatureregistration) |
25 |
26 | ## Public Methods
27 |
28 | ---
29 |
30 | ### RegisterFeatureRegistration
31 | Added in version 0.1.0
32 |
33 | ```csharp
34 | public void RegisterFeatureRegistration (FeatureRegistration featureRegistration)
35 | ```
36 |
37 | Registers a [```FeatureRegistration```](adaptivecards-rendering-xamarin-android-objectmodel-featureregistration.md) object for the card renderer to use.
38 |
39 | | Parameters | |
40 | | --- | --- |
41 | | featureRegistration | [```AdaptiveCards.Rendering.Xamarin.Android.ObjectModel.FeatureRegistration```](adaptivecards-rendering-xamarin-android-objectmodel-featureregistration.md) |
42 |
43 | #### Sample
44 |
45 | ```csharp
46 | FeatureRegistration featureRegistration = new FeatureRegistration();
47 | featureRegistration.AddFeature("MyFeature", "1.2.0");
48 | CardRendererRegistration.Instance.RegisterFeatureRegistration(featureRegistration);
49 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: RenderedAdaptiveCard class - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # RenderedAdaptiveCard
10 |
11 | ```csharp
12 | public class RenderedAdaptiveCard : Java.Lang.Object
13 | ```
14 |
15 | **Namespace**
16 |
17 | ```csharp
18 | namespace AdaptiveCards.Rendering.Xamarin.Android.Renderer
19 | ```
20 |
21 | ### Summary
22 |
23 | | Attributes | |
24 | | ---- | --- |
25 | | AdaptiveCard | Logical representation of the rendered adaptive card. |
26 | | Inputs | Dictionary of input element and information added by the user. |
27 | | View | Visual result from the rendering process. |
28 | | Warnings | List of warnings produced from the rendering process. |
29 |
30 |
31 |
32 | | Public methods | |
33 | | --- | ---- |
34 | | ```void``` | [```AddWarning AdaptiveCards.Rendering.Xamarin.Android.Renderer.AdaptiveWarning warning)```](#addwarning) |
35 |
36 | ## Public Methods
37 |
38 | ---
39 |
40 | ### AddWarning
41 | Added in version 0.1
42 |
43 | ```csharp
44 | public void AddWarning (AdaptiveWarning warning)
45 |
46 | ```
47 |
48 | Adds a warning to the warning list.
49 |
50 | | Parameters | |
51 | | --- | --- |
52 | | warning | ```AdaptiveCards.Rendering.Xamarin.Android.Renderer.AdaptiveWarning``` |
53 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/getting-started.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Getting started - Xamarin.Android
10 |
11 | This is a renderer library which targets native xamarin android applications and is based on the Android renderer that you can find [here](../../android/getting-started.md).
12 |
13 | ## NuGet install
14 |
15 | [](https://www.nuget.org/packages/AdaptiveCards.Rendering.Xamarin.Android)
16 |
17 | You can find the published packages [here](http://nuget.org)
18 |
19 | ```console
20 | Install-Package AdaptiveCards.Rendering.Xamarin.Android -Version 0.1.0-alpha
21 | ```
22 |
23 | ## Namespace
24 |
25 | The necessary namespaces for using this library are
26 | ```csharp
27 | // To import the base object model classes as AdaptiveCard, TextBlock, Column, ShowCardAction, ...
28 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
29 |
30 | // To import the AdaptiveCardRenderer class
31 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer;
32 |
33 | // To import the ICardActionHandler interface
34 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler;
35 |
36 | // To use feature registration and register custom behaviour
37 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer.Registration;
38 | ```
39 |
40 | ## Xamarin.Android Visualizer Sample
41 |
42 | The Xamarin.Android Visualizer sample lets you visualize cards using Xamarin.Android. If you have ever used the Android sample application you'll find the experience to be really similar.
43 |
44 | ## Next steps
45 |
46 | For a quick start check [Render a card](render-a-card.md) for the next steps!
47 |
48 | For a more in depth view of the classes that have been binded for the Xamarin.Android renderer library, you can check some of the binded classes by clicking on them below:
49 | * [```AdaptiveCard```](adaptivecards-rendering-xamarin-android-objectmodel-adaptivecard.md)
50 | * [```AdaptiveCardRenderer```](adaptivecards-rendering-xamarin-android-renderer-adaptivecardrenderer.md)
51 | * [```CardRendererRegistration```](adaptivecards-rendering-xamarin-android-renderer-cardrendererregistration.md)
52 | * [```FeatureRegistration```](adaptivecards-rendering-xamarin-android-objectmodel-featureregistration.md)
53 | * [```ICardActionHandler```](adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md)
54 | * [```RenderedAdaptiveCard```](adaptivecards-rendering-xamarin-android-renderer-renderedadaptivecard.md)
55 |
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/host-config.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Host config - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Host config - Android
10 |
11 | To customize the renderer you provide an instance of the HostConfig object. (See [Host Config Schema](../../../../rendering-cards/host-config.md) for the full description.)
12 |
13 | To create a ```HostConfig``` object from a string, use the ```DeserializeFromString``` method like this:
14 |
15 | ```csharp
16 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
17 | // ...
18 |
19 | HostConfig Config = HostConfig.DeserializeFromString(configJson);
20 | ```
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/native-styling.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Native styling - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Native styling - Xamarin.Android
10 |
11 | Native styling is supported just as the Android renderer library allows it which can be found [here](../../android/native-styling.md).
--------------------------------------------------------------------------------
/AdaptiveCards/sdk/rendering-cards/xamarin/android/render-a-card.md:
--------------------------------------------------------------------------------
1 | ---
2 | title: Render a card - Xamarin.Android SDK
3 | author: almedina-ms
4 | ms.author: almedina
5 | ms.date: 12/02/2019
6 | ms.topic: article
7 | ---
8 |
9 | # Render a card - Xamarin.Android
10 |
11 | Here's how to render a card using the Xamarin.Android SDK.
12 |
13 | ## Create Adaptive Card Object Instance from JSON Text
14 |
15 | ```csharp
16 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
17 | // ...
18 |
19 | ParseResult parseResult = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version);
20 | AdaptiveCard adaptiveCard = parseResult.AdaptiveCard;
21 | ```
22 |
23 | or you can also use a ```ParseContext``` object to be able to deserialize custom elements that are included in your adaptive card like this:
24 |
25 | ```csharp
26 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
27 | // ...
28 |
29 | ParseContext context = new ParseContext(); // Empty parseContext so only known elements up to v1.2 will be parsed
30 | ParseResult parseResult = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version, context);
31 | ```
32 |
33 | or
34 |
35 | ```csharp
36 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
37 | // ...
38 |
39 | ParseContext context = new ParseContext(elementParserRegistration, actionParserRegistration);
40 | ParseResult parseResult = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version, context);
41 | ```
42 |
43 | ## Render a card
44 |
45 | To be able to render a card you'll need some information
46 | * context: Obtainable from the Activity the card is hosted in
47 | * fragmentManager: can also be retrieved from the hosting activity
48 | * cardActionHandler: instance of [```ICardActionHandler```](adaptivecards-renderin-xamarin-android-renderer-actionhandler-icardactionhandler.md) to manage the action behaviour
49 |
50 | ```csharp
51 | using AdaptiveCards.Rendering.Xamarin.Android.ObjectModel;
52 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer;
53 | using AdaptiveCards.Rendering.Xamarin.Android.Renderer.ActionHandler;
54 | // ...
55 |
56 | var renderedCard = AdaptiveCardRenderer.Instance.Render(context, fragmentManager, adaptiveCard, cardActionHandler, hostConfig);
57 | View v = renderedCard.View;
58 | ```
59 |
--------------------------------------------------------------------------------
/AdaptiveCards/templating/content/2019-08-01-12-08-13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MicrosoftDocs/AdaptiveCards/bd0959c8ca19758bdba2635b159bc8d62c1665f6/AdaptiveCards/templating/content/2019-08-01-12-08-13.png
--------------------------------------------------------------------------------
/AdaptiveCards/templating/content/2019-08-01-13-58-27.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MicrosoftDocs/AdaptiveCards/bd0959c8ca19758bdba2635b159bc8d62c1665f6/AdaptiveCards/templating/content/2019-08-01-13-58-27.png
--------------------------------------------------------------------------------
/AdaptiveCards/toc.yml:
--------------------------------------------------------------------------------
1 | - name: Overview
2 | href: index.md
3 | - name: Getting Started
4 | items:
5 | - name: Bot Developers
6 | href: getting-started/bots.md
7 | - name: Windows Developers
8 | href: getting-started/windows.md
9 | - name: Outlook Developers
10 | href: getting-started/outlook.md
11 | - name: Authoring Cards
12 | items:
13 | - name: Getting Started
14 | href: authoring-cards/getting-started.md
15 | - name: Card Schema
16 | href: https://adaptivecards.io/explorer
17 | - name: Text Features
18 | href: authoring-cards/text-features.md
19 | - name: Input Validation
20 | href: authoring-cards/input-validation.md
21 | - name: Universal Bot Action Model
22 | href: authoring-cards/universal-action-model.md
23 |
24 | - name: Rendering Cards
25 | items:
26 | - name: Getting Started
27 | href: rendering-cards/getting-started.md
28 | - name: Actions
29 | href: rendering-cards/actions.md
30 | - name: Host Config
31 | href: rendering-cards/host-config.md
32 | - name: Extensibility
33 | href: rendering-cards/extensibility.md
34 | - name: Implement a Renderer
35 | href: rendering-cards/implement-a-renderer.md
36 | - name: SDKs
37 | items:
38 | - name: Authoring Cards
39 | href: sdk/authoring-cards/toc.yml
40 | - name: Rendering Cards
41 | href: sdk/rendering-cards/toc.yml
42 | - name: Designer SDK
43 | href: sdk/designer.md
44 | - name: Templating
45 | items:
46 | - name: Overview
47 | href: templating/index.md
48 | - name: Template Language
49 | href: templating/language.md
50 | - name: Templating SDKs
51 | href: templating/sdk.md
52 | - name: Template Service
53 | href: templating/service.md
54 | - name: Resources
55 | items:
56 | - name: Principles
57 | href: resources/principles.md
58 | - name: Partners
59 | href: resources/partners.md
60 | - name: Tools
61 | href: resources/tools.md
62 | - name: Roadmap
63 | href: resources/future.md
64 |
--------------------------------------------------------------------------------
/LICENSE-CODE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright (c) Microsoft Corporation
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
5 | associated documentation files (the "Software"), to deal in the Software without restriction,
6 | including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 | and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
8 | subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all copies or substantial
11 | portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
14 | NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
15 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
16 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Microsoft Open Source Code of Conduct
2 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
3 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | ## Security
4 |
5 | Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
6 |
7 | If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
8 |
9 | ## Reporting Security Issues
10 |
11 | **Please do not report security vulnerabilities through public GitHub issues.**
12 |
13 | Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
14 |
15 | If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
16 |
17 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
18 |
19 | Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
20 |
21 | * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
22 | * Full paths of source file(s) related to the manifestation of the issue
23 | * The location of the affected source code (tag/branch/commit or direct URL)
24 | * Any special configuration required to reproduce the issue
25 | * Step-by-step instructions to reproduce the issue
26 | * Proof-of-concept or exploit code (if possible)
27 | * Impact of the issue, including how an attacker might exploit the issue
28 |
29 | This information will help us triage your report more quickly.
30 |
31 | If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
32 |
33 | ## Preferred Languages
34 |
35 | We prefer all communications to be in English.
36 |
37 | ## Policy
38 |
39 | Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
40 |
41 |
42 |
--------------------------------------------------------------------------------
/ThirdPartyNotices:
--------------------------------------------------------------------------------
1 | ##Legal Notices
2 | Microsoft and any contributors grant you a license to the Microsoft documentation and other content
3 | in this repository under the [Creative Commons Attribution 4.0 International Public License](https://creativecommons.org/licenses/by/4.0/legalcode),
4 | see the [LICENSE](LICENSE) file, and grant you a license to any code in the repository under the [MIT License](https://opensource.org/licenses/MIT), see the
5 | [LICENSE-CODE](LICENSE-CODE) file.
6 |
7 | Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation
8 | may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries.
9 | The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks.
10 | Microsoft's general trademark guidelines can be found at https://go.microsoft.com/fwlink/?LinkID=254653.
11 |
12 | Privacy information can be found at https://privacy.microsoft.com/en-us/
13 |
14 | Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents,
15 | or trademarks, whether by implication, estoppel or otherwise.
--------------------------------------------------------------------------------