Adaptive Cards - Nested scheme

十年热恋 提交于 2019-12-11 00:27:05

问题


Is it possible to include action inside columnSet/column in the adaptive cards ?

For example I want something like this :-

----- Body
       |___ columnSet
                |___ column1
                |       |___textblock
                |       |___image
                |       |___action.url
                |
                |___ column2
                |       |___textblock
                |       |___image
                |       |___action.url

I did try it with visualiser but the action.url doesn't show despite the visualiser did not show any error.

Thank you for your help.


回答1:


Column has a selectAction property that can turn the column into a hit target.

            {
                "type": "Column",
                "items": [
                    {
                        "type": "TextBlock",
                        "text": "Column 1"
                    },
                    {
                        "type": "Image",
                        "url": "http://adaptivecards.io/api/cat"
                    }
                ],
                "selectAction": {
                    "type": "Action.OpenUrl",
                    "title": "cool link",
                    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
                }

See here for a working example:

http://adaptivecards.io/visualizer/?card=/explorer/cards/Column.SelectAction.json




回答2:


If you don't have control over the card rendering, then I don't think so.

Per the documentation: "actions - Many cards have a set of actions a user may take on it. This property describes those actions which typically get rendered in an "action bar" at the bottom."

It says typically, but it seems they are always rendered at the bottom of the card. Unless you are displaying adaptive cards within your own application, I don't think it's possible to make changes to the way they are rendered.

A potential workaround would be to use a selectaction on an image, and then make your own button for the image. It should work the same way as an action at that point, but will be able to placed anywhere you can place an image. There is the downside of needing to create and host an image for your button though.



来源:https://stackoverflow.com/questions/45181772/adaptive-cards-nested-scheme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!