Here we discuss the low-level touch events in Windows Phone 7. In this example when we touch on the TextBlock, it changes its color and text.
For this follow these steps:
Step 1: First we click on: File -> New Project -> Windows Phone Application.
After that we set its name and the location of where we want to save it.
Step 2: After that we create a TextBlock in the ContentPanel like this:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<TextBlock Height="30" HorizontalAlignment="Left" Margin="10,10,0,0" Name="textBlock1" Text="TextBlock" VerticalAlignment="Top" />
</Grid>
Step 3: After that we write the following code in the .cs page:
Random random1 = new Random();
Brush brush1;
// Constructor
public MainPage()
{
InitializeComponent();
brush1 = textBlock1.Foreground;
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment
It is the same account you read, post and publish with — and you will come straight back to this page.


Varesh TuliPosted Jul 20, 2012, 5:31 AM
Thanks for this knowledgeable article. It helps us to operate Windows Phone 7.