在WPF中将文本框更改为标签 [英] Change textbox to Label in Wpf

查看:435
本文介绍了在WPF中将文本框更改为标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击将所有文本框更改为标签"按钮时,是否可以在WPF中使用

When i click button Change all textbox to label is it possible in WPF

推荐答案

没有正当的理由,我几乎当然.什么是变化"?这些是不同的类型.您真的了解一般的类型和实例吗?您可以删除TextBox的每个实例,并在同一位置插入Label的实例,但是为什么呢?

您还应该了解,标签的主要目的是为某些带有标签的控件提供键盘快捷键,如XAML片段中所示,使用"_"字符:
There is no a valid reason to do it, I''m pretty much sure. And what is "change"? These are different types. Do you really understand types and instances in general? You can remove each of the instances of the TextBox and insert and instances of the Label in the same place, but why?

You should also understand that the main purpose of the label is to provide a keyboard shortcut for some control labelled with a label, using ''_'' character as in this XAML fragment:
<Label Target="{Binding ElementName=tb}">_File</Label>

(请参阅 http://msdn.microsoft.com/en-us/library/system.windows.controls.label.aspx [

(Please see http://msdn.microsoft.com/en-us/library/system.windows.controls.label.aspx[^].)

If you don''t do this, there is no need in Label functionality, and there is no any binding information in the TextBox. So, you can really use label functionality for something which is the label in first place.

Overall, the question makes little sense. For future, if you want something this exotic, you should start with explaining your ultimate goal. That way you can get a chance to get a really useful advice.

—SA


这篇关于在WPF中将文本框更改为标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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