microsoft-ui-xaml: Setting tooltip using attached method syntax in resw no longer works in WinUI 3 Preview 3

Describe the bug Setting tooltip using attached method syntax in resw no longer works in WinUI 3 Preview 3

Steps to reproduce the bug

  1. Start with WinUI 3 Desktop app template

  2. Declare some UI element with Uid:

<Button x:Uid="button1" />
  1. Create Resources.resw under Strings\en, and add a <PRIResource Include=Strings\**\*.resw to the project.

  2. Add tooltip in the resource file. According to UWP doc, the syntax for the key should be button1.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip.

  3. Run the app. The app will fail with XamlParseException.

Expected behavior The app should work with tooltip set from the localized resource. It worked in preview 2. This is a regression in preview 3.

Version Info

NuGet package version:

Microsoft.WinUI 3.0.0-preview3.201113.0

Windows app type:

UWP Win32
Yes
Windows 10 version Saw the problem?
20H2(19042) Yes
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

@JosHuybrighs Because ToolTipService.ToolTip is an attached property, the correct syntax to use is MyButton.[using:Microsoft.UI.Xaml.Controls]ToolTipService.ToolTip (see this article for more details).

@roxk I’ve also met the tooltip issue here

The current workaround is explicitly define a ToolTip element:

<Button>
    <ToolTipService.ToolTip>
        <ToolTip x:Uid="button1ToolTip" />
    </ToolTipService.ToolTip>
</Button>

and set button1ToolTip.Content in resources.