自适应卡列样式在Adaptive Designer中起作用,但在WebChat中不起作用

时间:2020-02-22 14:44:12

标签: botframework adaptive-cards

我正在使用Adaptive Card 1.2版,并且试图为Adaptive Column添加样式。该样式正反映在Adaptive Designer(网络聊天)中。但是,如果我尝试签入托管的Web聊天样式,也不会得到反映。我还要提到我正在使用C#创建自适应卡。

Required Result

但是看起来像这样
Current Result

我正在将此用于网络聊天(https://cdn.botframework.com/botframework-webchat/latest/webchat.js

这是我的C#代码

AdaptiveCard card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0));
card.Body.Add(new AdaptiveTextBlock()
{
    Text = $"Hello User",
    HorizontalAlignment = AdaptiveHorizontalAlignment.Center
});
card.Body.Add(new AdaptiveTextBlock()
{
    FontType = AdaptiveFontType.Monospace,
    Text = "Would you like to rate us",
    Color = AdaptiveTextColor.Good,
    Weight = AdaptiveTextWeight.Bolder,
    HorizontalAlignment = AdaptiveHorizontalAlignment.Center,
    Separator = true
}); 
card.Body.Add(new AdaptiveColumnSet()
{
    Separator = true,
    Columns = new List<AdaptiveColumn>()
        {
            new AdaptiveColumn()
            {
            Bleed = true,
            Width = AdaptiveColumnWidth.Stretch,
            Style = AdaptiveContainerStyle.Emphasis,
             SelectAction = new AdaptiveSubmitAction()
            {
                Title = "1",
                DataJson = "{ \"Type\": \"1\" }"
            },
            Items = new List<AdaptiveElement>()
            {
                new AdaptiveTextBlock()
                {
                    Text = "1",
                }
            }
        },
            new AdaptiveColumn()
        {
            Bleed = true,
            Width = AdaptiveColumnWidth.Stretch,
            Style = AdaptiveContainerStyle.Accent,
             SelectAction = new AdaptiveSubmitAction()
            {
                Title = "2",
                DataJson = "{ \"Type\": \"2\" }"
            },
            Items = new List<AdaptiveElement>()
            {
                new AdaptiveTextBlock()
                {
                    Text = $"2"
                }
            }
        },
            new AdaptiveColumn()
        {
            Bleed = true,
            Width = AdaptiveColumnWidth.Stretch,
            Style = AdaptiveContainerStyle.Good,
            SelectAction = new AdaptiveSubmitAction()
            {
                Title = "3",
                DataJson = "{ \"Type\": \"3\" }"
            },
            Items = new List<AdaptiveElement>()
            {
                new AdaptiveTextBlock()
                {
                    Text = $"3"
                }
            }
        },
            new AdaptiveColumn()
            {
            Bleed = true,
            Width = AdaptiveColumnWidth.Stretch,
            Style = AdaptiveContainerStyle.Attention,
            SelectAction = new AdaptiveSubmitAction()
            {
                Title = "4",
                DataJson = "{ \"Type\": \"4\" }"
            },
            Items = new List<AdaptiveElement>()
            {
                new AdaptiveTextBlock()
                {
                    Text = $"4"
                }
            }
        }
    }
});  

请帮助我

0 个答案:

没有答案