Hola que tal tengo el siguiente el código en mi app windows phone, pero cuando trato de modificar el contenido de un control TextBloc en su propiedad text con un hilo tengo el siguient error:
Invalid cross-thread access
Como puedo evitar esto?? Gracias!
namespace PhoneApp2
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
{
}
private void button1_Click(object sender, RoutedEventArgs e)
{
Thread Hilo = new Thread(new ThreadStart(Funcion));
Hilo.Start();
}
private void Funcion()
{
for (int Contador = 0; Contador <= 10; Contador++)
{
PageTitle.Text = Convert.ToString(Contador); //AQUÍ TENGO EL ERROR
Thread.Sleep(500);
}
}
}
}