Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shared/UWP] Add IsEnabled property to actions #5734

Merged
merged 10 commits into from
Apr 29, 2021
Merged

Conversation

RebeccaAnne
Copy link
Contributor

@RebeccaAnne RebeccaAnne commented Apr 26, 2021

Related Issue

Fixes #5723
Fixes #5721

Description

Add isEnabled property to actions in the shared model and UWP and updated the UWP renderer code to respect it

Sample Card

New sample card added samples\v1.5\Elements\Action.IsEnabled.json

How Verified

  1. Updated Everything Bagel shared model test to validate new property
  2. Updated UWP object model test to validate new property
  3. Validated IsEnabled property works as expected in the visualizer using the above card.
Microsoft Reviewers: Open in CodeFlow

@@ -617,9 +625,19 @@ namespace AdaptiveNamespace::ActionHelpers
ComPtr<IAdaptiveHostConfig> hostConfig;
THROW_IF_FAILED(renderContext->get_HostConfig(&hostConfig));

if (ActionHelpers::WarnForInlineShowCard(renderContext, action, L"Inline ShowCard not supported for SelectAction"))
// We don't wrap the element if it's a show card or if the action's not enabled;
bool dontWrap = ActionHelpers::WarnForInlineShowCard(renderContext, action, L"Inline ShowCard not supported for SelectAction");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we make this shouldWrap -- we should avoid negatives in bools :D

@@ -90,6 +90,15 @@ namespace AdaptiveNamespace
return AdaptiveActionElementBase::put_Tooltip(tooltip);
}

IFACEMETHODIMP put_IsEnabled(boolean isEnabled) override
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely not something to do in this PR, but I think if we refactor our classes using cppwinrt, we should be able to derive classes in a way that makes it so we can get out of the business of manually calling the base (LinkButton does something similar to this).

guessing it might require breaking API surface changes, so maybe part of our next major rev? just a thought :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, I'd love to get more cppwinrt in here. I feel like it shouldn't require breaking changes? But I don't know. Definitely something to work towards at some point.

@RebeccaAnne RebeccaAnne merged commit 6de51f2 into main Apr 29, 2021
@RebeccaAnne RebeccaAnne deleted the rebecch/uwpisenabled branch April 29, 2021 20:34
michaelfarnsworth pushed a commit to michaelfarnsworth/AdaptiveCards that referenced this pull request Nov 10, 2022
* [Shared] Add IsEnabled to the shared model

* [UWP] Add IsEnabled to the object model

* [UWP] Renderer Support

* PR feedback
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
* [Shared] Add IsEnabled to the shared model

* [UWP] Add IsEnabled to the object model

* [UWP] Renderer Support

* PR feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Shared] Action isEnabled [UWP] Action isEnabled
2 participants