Setting the Text in a TextBlock
I have created a small test Windows Store app. I am testing it on both Windows 10 and the Windows 10 Core on a Raspberry Pi 2B. The program, as written, runs just fine. However I want to change the text in a TextBlock to the value of an integer (read from a sensor) when the user presses a button. I can certainly change the text in the TextBlock to a different text constant, as in:
<TextBlock Grid.Row="1" x:Name="AccumulatorDisplay" Text="0" TextWrapping="NoWrap" TextAlignment="Center" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
FontSize="25"/>
AccumulatorDisplay->Text = "13";
But what I want to accomplish is something like:
char szBuffer[32];
int iSensorReading;
// Read the sensor value into iSensorReading...
_itow_s(SensorReading, szBuffer1, 32, 10);
AccumulatorDisplay->Text = szBuffer1;
That is, I want to set the text in my AccumulatorDisplay to the text value of the SensorReading. I have not found a way to do it, and there does not appear to be anything in Chapter 18 to give me a hint.
Thank you for your time and consideration!
|