'Setting up host config for adaptive card in bot framework
I wanted to know how to setup hostconfig to my adaptive card for styles. Im new to bot framework and wanted to know how to implement host config for adaptive card in c# , even checked [https://docs.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/javascript/host-config]. this is my adaptive card below card.json and guide me step by step creating the host config for the below card.
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"actions": [
{
"type": "Action.Submit",
"title": "Sign-up",
"data": "${signin}",
"id": "7"
},
{
"type": "Action.Submit",
"title": "Password Reset",
"data": "${preset}",
"id": "8"
}
],
"body": [
{
"type": "TextBlock",
"wrap": true,
"text": "Menu",
"style": "heading",
"fontType": "Default",
"color": "Good",
"weight": "Bolder",
"id": "1"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ShowCard",
"title": "Sign-in",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Username",
"label": "Your name (Last, First)",
// "validation": "^[A-Z][a-z]+, [A-Z][a-z]+$",
"data": "${username}",
"wrap": true,
"id": "3"
},
{
"type": "TextBlock",
"text": "Password",
"wrap": true,
"id": "5"
},
{
"type": "Input.Text",
"placeholder": "***********",
"style": "padding=2px",
"id": "6"
}
]
},
"id": "2"
}
]
}
]
}
Solution 1:[1]
You can try in this way.
// Construct programmatically
renderer.HostConfig = new AdaptiveHostConfig()
{
FontFamily = "Comic Sans",
FontSizes = {
Small = 15,
Default = 20,
Medium = 25,
Large = 30,
ExtraLarge= 40
}
};
// Or parse from JSON
renderer.HostConfig = AdaptiveHostConfig.FromJson(@"{
""fontFamily"": ""Comic Sans"",
""fontSizes"": {
""small"": 25,
""default"": 26,
""medium"": 27,
""large"": 28,
""extraLarge"": 29
}
}");
Please refer to this link. https://docs.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/net-html/host-config
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rijwan Ansari |
