Windows Phone 8 threading Invalid cross-thread access

前端 未结 2 983
攒了一身酷
攒了一身酷 2021-01-23 04:54

I\'m making a Tic-Tac-Toe game for Windows Phone 8 and I want the game to play vs itself as a background for the main menu

private Button[] bts;
private List<         


        
2条回答
  •  时光说笑
    2021-01-23 05:30

    You cannot access the UI thread from any other thread directly. So, Encose your UI access code in the Dispatcher.BeginInvoke()

    Dispatcher.BeginInvoke(() =>
        {
            foreach (Button i in bts)
               i.Content = "";
        });
    

提交回复
热议问题