在 WPF 中设置子窗口控件的文本

发布于 2024-08-21 12:36:09 字数 69 浏览 4 评论 0原文

如何设置子窗口文本块的文本。 childWindowname.textblockName.Text = "" 没有任何效果。

How can i set a text of a textblock of a child window. childWindowname.textblockName.Text = "" doesn't have any effect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情话难免假 2024-08-28 12:36:09

奇怪的。我已经使用代码隐藏中的文本来更改窗口中的文本,没有任何问题。唯一的区别是我在子窗口中有一个我调用的公共方法,并且设置了 textblockname.Text。

例如

public void SetTextBlockMessage(string message)
{
  textblockname.Text = message;
}

Odd. I have used Text from codebehind to change the text in my window without any problems. The only difference is that I had a public method in my child window that I called, and that set textblockname.Text.

e.g.

public void SetTextBlockMessage(string message)
{
  textblockname.Text = message;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文