I am completely new developer at Windows Phone 7. I have TextBlock Text="{Binding MyDate}
on MainPage.xaml page.
How can I change color of this TextBlock from MainPage.xaml.cs?
Firstly, you need to give the TextBlock
element an x:Name
attribute, e.g. x:Name="myTextBlock"
. Once you've done this, the TextBlock is available in the code-behind as a field with the same name as what you put in the x:Name
.
To set the foreground color of a TextBlock, you can use something like
myTextBlock.Foreground = new SolidColorBrush(someColor);