Share via

C++/WinRT XAML basics question

Ryan Gallagher 21 Reputation points
2020-06-29T20:00:05.047+00:00

I switched from CX to WinRT and while I figured out fairly quickly with CX how to get or set properties of XAML controls with WinRT it seems I am having issues.

myTextBlock().Text();

I am guessing this is the way to start. How do I set the value for text?
I feel like I am missing something simple here.

Thanks for your help!

Edit: Oh if you can point me to the documentation for it that would be sweet. Again I think I am just not versed enough in C++ to recognize what I am looking for.

Developer technologies | Universal Windows Platform (UWP)

Answer accepted by question author

Fay Wang - MSFT 5,231 Reputation points
2020-06-30T02:56:36.4+00:00

Hello,

Welcome to Microsoft Q&A!

If you want to set the text, just need to pass the string value to the .Text() method, like

myTextBlock().Text(L"Hello");  

Here is the document about TextBlock.Text in C++/WinRT, you can check its syntax. In addition, for more details about C++/WinRT, you can refer to this document.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

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