String appearing blank when trying to use it in 2 different components

Apptacular Apps 386 Reputation points
2020-06-05T14:02:26.617+00:00

I'm trying to use the same string resource for 2 different components but they both appear blank. How can this problem be fixed?

Resources.resw

  • ContactUs.Label - Contact Us
  • ContactUs.Text - Contact Us

Main page

        <AppBarButton Name="AppBarButtonContactUs" x:Uid="ContactUs.Label"/>

2nd page

        <TextBlock x:Uid="ContactUs.Text" Style="{StaticResource HeaderTextBlockStyle}" />
Universal Windows Platform (UWP)
{count} votes

2 answers

Sort by: Most helpful
  1. Daniele 1,996 Reputation points
    2020-06-05T14:49:20.82+00:00

    The reason of "Unable to resolve property 'Text' while processing properties for x:Uid 'ContactUs'." is that AppBarButton has x:Uid ContactUs but no property Text, the x:Uid must be different if the target property is different.

    You can do like that:

       <TextBlock x:Uid="ContactUs_Text" />  
       <AppBarButton x:Uid="ContactUs_Label" />  
    

    and in Resource.resw

    9245-resources.png

    1 person found this answer helpful.
    0 comments No comments

  2. Matt Lacey 791 Reputation points MVP
    2020-06-05T14:04:51.327+00:00

    Set the Uid of both to be "ContactUs".

    Have two resource entries
    "ContactUs.Label" and "ContactUs.Text" which both have the same value.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.