如何在代码中向WPF标签添加文本? [英] How to add text to a WPF Label in code?

查看:86
本文介绍了如何在代码中向WPF标签添加文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得很愚蠢,但是无法找出如何在代码中向WPF Label控件添加文本。像下面这样的TextBlock:

I feel stupid but cannot find out how to add a text to a WPF Label control in code. Like following for a TextBlock:

DesrTextBlock.Text = "some text";

Label中的等效属性是什么?

What is equivalent property in Label for doing it?

DesrLabel.??? = "some text"; //something like this


推荐答案

尝试 DesrLabel.Content 。这是WPF方式。

Try DesrLabel.Content. Its the WPF way.

这篇关于如何在代码中向WPF标签添加文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆