我正在尝试将背景图像添加到自适应卡中。目前我使用的是自适应卡1.2版,我已经将图像添加到项目内的一个文件夹中。但是我得到了Could not determine JSON object type for type AdaptiveCards.AdaptiveBackgroundImage异常。
Uri uri = new System.Uri(@"~\Images\AdaptiveCard_Background.png",UriKind.Relative);
card.Add(new AdaptiveBackgroundImage()
{
Url = uri
});请帮助我解决这个问题
发布于 2019-07-26 12:05:13
在您的适配卡中,您可以添加一个字段backgroundImage:
如下所示:
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"backgroundImage":"https://i.pinimg.com/originals/e1/a9/a0/e1a9a0fa5a6d08336e32218f41ab4957.jpg",
"body":[
// your adaptive card body here
],
"actions":[
// your adaptive card actions here
]
}你可以在这里找到更多的适配卡样本:https://adaptivecards.io/samples Hope,这对你有帮助。
发布于 2020-02-21 19:03:45
在做了一些研究后,我发现对于V4解决方案,我们需要将图像添加到wwwroot文件夹中的一个子文件夹中。在appsettings.json文件中,我们需要提到我们托管该文件的网址。如果我们在本地运行它,那么我们需要提到本地仿真器URL。使用IConfiguration获取URL
card.BackgroundImage = new Uri(configuration["BaseURI"] + "Images/BlueBackground.png");希望这对其他正在尝试使用卡内图像的人有所帮助。
https://stackoverflow.com/questions/57180971
复制相似问题