英文:
AdaptiveCard: Action.ToggleVisibility for Action
问题
以下是您要翻译的内容:
"Is it possible to toggle the visibility of an Adaptivecard action? The following does not work:
{
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "Press the buttons to toggle the button!",
"wrap": true
}
],
"actions": [
{
"id": "btnShow",
"type": "Action.ToggleVisibility",
"title": "Show!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": true
},
{
"elementId": "btnShow",
"isVisible": false
}
]
},
{
"id": "btnHide",
"type": "Action.ToggleVisibility",
"title": "Hide!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": false
},
{
"elementId": "btnShow",
"isVisible": true
}
],
"isVisible": false
}
]
}"
英文:
Is it possible to toggle the visibility of an Adaptivecard action? The following does not work:
{
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "Press the buttons to toggle the button!",
"wrap": true
}
],
"actions": [
{
"id": "btnShow",
"type": "Action.ToggleVisibility",
"title": "Show!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": true
},
{
"elementId": "btnShow",
"isVisible": false
}
]
},
{
"id": "btnHide",
"type": "Action.ToggleVisibility",
"title": "Hide!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": false
},
{
"elementId": "btnShow",
"isVisible": true
}
],
"isVisible": false
}
]
}
答案1
得分: 1
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "按下按钮以切换按钮状态!",
"wrap": true
},
{
"id": "btnShow",
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "显示!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": true
},
{
"elementId": "btnShow",
"isVisible": false
}
]
}
]
},
{
"id": "btnHide",
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "隐藏!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": false
},
{
"elementId": "btnShow",
"isVisible": true
}
]
}
],
"isVisible": false
}
],
"actions": []
}
英文:
Actions alone cannot be hidden/shown. They need to be nested in a container within body, which supports that feature. This one is an alternative:
{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
{
"type": "TextBlock",
"text": "Press the buttons to toggle the button!",
"wrap": true
},
{
"id": "btnShow",
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Show!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": true
},
{
"elementId": "btnShow",
"isVisible": false
}
]
}
]
},
{
"id": "btnHide",
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Hide!",
"targetElements": [
{
"elementId": "btnHide",
"isVisible": false
},
{
"elementId": "btnShow",
"isVisible": true
}
]
}
],
"isVisible": false
}
],
"actions": []
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论