Could we use resources from the .resw without the x:uid by directly binding the resource for the xaml property

Vishal G R 5 Reputation points
2023-05-17T11:30:53.55+00:00

We are in the process of moving in-app strings to resource files for our Winui3 application. In this, we are now using x:uid for the XAML controls.

We would like to know whether we can use Resource Manager to get the resource for each property of the XAML controls

X:Uid Approach:
Screenshot 2023-05-17 155605

Resource Binding Approach:

Screenshot 2023-05-17 160139

Code behind:

User's image

Will this have any effect on the performance? or Is x:uid approach preferred for Winui3 applications

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
509 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,207 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
644 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 5,901 Reputation points Microsoft Vendor
    2023-05-18T02:24:30.5866667+00:00

    Hello,

    Welcome to Microsoft Q&A!

    As far as I'm concerned, both methods are fine, and you could choose whichever method you want in winui3.

    In my opinion, the x:Uid method is relatively simpler.

    Thank you.

    Jeanine


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.