Load the line resource for the textblock x: Uid in the code behind
I have a string resource that I am using to set as x: uid for a text block
<data name="Expected.Text" xml:space="preserve">
<value>Expected Text</value>
</data>
<TextBlock x:Name="control" x:uid="Expected />
I am trying to write a Unit test to check if the text is correct. However, I cannot get the handle to the string "Expected" because at the end it has a .text to show up in the TextBlock
ResourceLoader loader = ResourceLoader.GetForCurrentView();
var expected = loader.GetString("Expected");
Assert.AreEqual(expected, control.Text);
This code fails because var is expected to be empty
+3
Frank sposaro
source
to share
1 answer
You can access this property using the following notation:
var expected = loader.GetString("Expected/Text");
+6
Fred
source
to share