Skip to content

Instantly share code, notes, and snippets.

@DeeJayTC
Last active May 2, 2020 21:47
Show Gist options
  • Save DeeJayTC/fa795c8859888d87983a41ab2a335298 to your computer and use it in GitHub Desktop.
Save DeeJayTC/fa795c8859888d87983a41ab2a335298 to your computer and use it in GitHub Desktop.
{
"{<property>}": "Implicitly binds to `$data.<property>`",
"$data": "The current data object",
"$root": "The root data object.",
"$index": "The current index when iterating",
"$host": "Access properties of the host *(not working yet)*"
}
{
"type": "AdaptiveCard",
"body": [{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "My list of people"
},
{
"type": "FactSet",
"facts": [{
"title": "Micky Mouse",
"value": "44"
},
{
"title": "Harry Potter",
"value": "18"
},
{
"title": "Matt Hidinger",
"value": "28"
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
// Create card
var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
{
// Use LINQ to turn the choices into submit actions
Actions = choices.Select(choice => new AdaptiveSubmitAction
{
Title = choice,
Data = choice, // This will be a string
}).ToList<AdaptiveAction>(),
};
{
"title": "My list of people:",
"count": 4,
"people": [{
"firstName": "Micky",
"lastName": "Mouse",
"age": 44
},
{
"firstName": "Donald",
"lastName": "Duck",
"age": 12
},
{
"firstName": "Harry",
"lastName": "Potter",
"age": 18
},
{
"firstName": "Matt",
"lastName": "Hidinger",
"age": "28"
}
]
}
{
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"size": "Medium",
"weight": "Bolder",
"text": "{title}"
},
{
"type": "FactSet",
"facts": [
{
"$data": "{people}",
"$when": "{$index.age > 12}",
"title": "{$index.firstName} {$index.lastName}",
"value": "{$index.age}"
}
]
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment