Universal Windows Platform (UWP)
A Microsoft platform for building and publishing apps for Windows desktop devices.
2,933 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How can a string resource be used for a TextBox?
I understand that I need to use something like:
<x:String x:Key="Placeholder">Placeholder Content</x:String>
but I don't know how.
<TextBox
x:Name="nameInput"
PlaceholderText="Find a setting"
Width="300"
HorizontalAlignment="Left"
Margin="0,0,0,20" />
If I understand correctly you want to put that Placeholder in TextBox.PlaceholderText. Then define a resource
<Page.Resources>
<x:String x:Key="Placeholder">Placeholder Content</x:String>
</Page.Resources>
and use it as StaticResource in the TextBox.PlaceholderText
<TextBox PlaceholderText="{StaticResource Placeholder}"/>
You can also define strings in a resource (RESW) file and use Unique Identifiers (Uid) to connect the resource with where it should be used: