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

Adding conditional tooltip class #4202

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dpaulino
Copy link
Contributor

Fixes

Fixes #4199.

This feature adds an attached property that can conditionally enable or disable a tooltip. This is useful for a11y scenarios, such as when a textblock gets trimmed due to 225% text scale, this conditional tooltip can be activated when the target element is trimmed. Thus, a tooltip would be shown only when the textblock is trimmed.

PR Type

What kind of change does this PR introduce?

  • Feature

What is the current behavior?

None

What is the new behavior?

New feature

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Pull Request has been submitted to the documentation repository instructions. Link:
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

Other information

@ghost
Copy link

ghost commented Aug 30, 2021

Thanks dpaulino for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

@ghost ghost requested review from michael-hawker, azchohfi and Rosuavio August 30, 2021 04:26
@ghost ghost added the feature request 📬 A request for new changes to improve functionality label Aug 30, 2021
@michael-hawker michael-hawker added this to the 7.2/8.0? milestone Aug 30, 2021
Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

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

Seems straight-forward enough, provided a couple of suggestions to integrate with the Toolkit repo. Then a sample page can be handy. Trying to think if I've tried to set anything other than a string to a Tooltip and what's happened... can you just use a TextBlock element to get fancy formatting?

Added this to the next milestone as we've closed out features for 7.1.

using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Microsoft.Toolkit.Uwp.UI.Extensions
Copy link
Member

Choose a reason for hiding this comment

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

We started flattening our namespace, so all extensions moved to just be in the UI domain.

/// Provides attached dependency properties that allow a <see cref="UIElement"/>
/// to conditionally enable or disable its tooltip.
/// </summary>
public class ConditionalToolTip : DependencyObject
Copy link
Member

Choose a reason for hiding this comment

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

This can just be a partial class off our existing UIElementExtensions class, it doesn't need to be its own DependencyObject.

@michael-hawker
Copy link
Member

@dpaulino is this something you still wanted to clean-up and contribute?

@dpaulino
Copy link
Contributor Author

Yes! sorry I've been busy outside work and forgot this. I'll try to get to it this weekend

@michael-hawker michael-hawker added the labs 🧪 Marks an issue/PR involved with Toolkit Labs label Aug 9, 2022
@michael-hawker michael-hawker removed the request for review from Rosuavio August 26, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request 📬 A request for new changes to improve functionality labs 🧪 Marks an issue/PR involved with Toolkit Labs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Conditional tooltip attached property
2 participants