FindName returning null

前端 未结 2 393
青春惊慌失措
青春惊慌失措 2020-12-11 06:00

I\'m writing a simple tic tac toe game for school. The assignment is in C++, but the teacher has given me permission to use C# and WPF as a challenge. I\'ve gotten all the g

2条回答
  •  醉话见心
    2020-12-11 06:40

    You have to create a new NameScope for your window:

    NameScope.SetNameScope(this, new NameScope());
    

    Then you register name of your label with the window:

    RegisterName(statusDisplay.Name, statusDisplay);
    

    So this seems to be all you need to do to make FindName() work.

提交回复
热议问题