Search code examples
uwpwindows-10windows-10-universaluwp-xamlresourcedictionary

Using TooltipService.Tooltip Keyword in a Resource Dictionary for UWP


I'm translating my UWP app via x: UID property like this.

Code (XAML):

<NavigationViewItem  x:Name="Assistant_Mode" x:Uid="Assistant_Header" Content="Asistan modu" Tag="assistant" ToolTipService.ToolTip="Asistan modu." FontFamily="Segoe UI">

Resource Dictionary record:

Assistant_Header.Content: Asistan modu

Now, I want translate the ToolTipService.ToolTip via Resource dictionary but this keyboard is not work in Dictionary:

Assistant_Header.ToolTipService.ToolTip: Asistan modu

Can I transalte a Tooltip in a Resource Dictionary ? Thanks.


Solution

  • Something you may need to notice is that official recommend way is described in ResourceDictionary and localization:

    A XAML ResourceDictionary might initially contain strings that are to be localized. If so, store these strings as project resources instead of in a ResourceDictionary. Take the strings out of the XAML, and instead give the owning element an x:Uid directive value. Then, define a resource in a resources file. Provide a resource name in the form XUIDValue.PropertyName and a resource value of the string that should be localized.

    If changing with this way still does not work, what about put the x:uid to the textbox inside ToolTipService.ToolTip, like the following code:

        <Button Content="Button with a simple ToolTip." >
            <ToolTipService.ToolTip>
                <TextBlock x:Uid="test" Text="123456"/>
            </ToolTipService.ToolTip>
        </Button>