editing XAML textbox not from MainPage class

前端 未结 2 1865
情书的邮戳
情书的邮戳 2021-01-27 14:00

I have the MainPage class which I can edit the contents of the XAML textbox from using this code

box1.Text = \"\";

however trying to edit the t

2条回答
  •  不知归路
    2021-01-27 14:36

    You are trying to access a static field of the MainPage class without an object instance.

    You'll need an instance of the MainPage class to access it like this:

    MainPage myPage = new MainPage();
    myPage.box1.Text = "";
    

提交回复
热议问题