I have a text box which is bound to a data service to get its contents. At the moment the data service puts a number between 1 and 9 into that text box. What I need to do is based on that value replace the contents of that text box with a string. So for example if the original contents of the textbox was “1” instead it would be replaced with “1 – Example text here”
Below is the code where the text box is defined.
<StackPanel Margin="0,0,0,17" Width="432">
<TextBlock Text="{Binding Category1}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Category2}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock Text="{Binding Category3}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
I thought that possibly I would use an else if statement but I don’t know how to reference the textblock from within that if statement.
Thanks for your help
You need to name the TextBlock so it can ve referenced by the code behind so something like the code below will work