textbox.text如何是XAML中的可绑定属性 [英] How textbox.text is bindable property in XAML

查看:69
本文介绍了textbox.text如何是XAML中的可绑定属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WPF中,依赖属性提供绑定,样式和动画等,因为读取了几个地方但是TextBox.Text如何是XAML中的可绑定属性,因为当我们看到Text的元数据时,它是一个普通的CLR属性。是TextBox.Text属性是依赖属性。

 [DefaultValue()] 
[Localizability(LocalizationCategory.Text)]
public string Text {get;组; }





我尝试过:



正如我已经看到TextBox.Text的元数据它是一个普通的属性。

解决方案

这完全没问题,DependencyProperties几乎总是带有这样的clr-property实际静态表示的包装。



只需查看propdpVisualStudio-CodeSnippet,就可以生成这种访问器。



在你的情况下,只需注意静态只读DependencyProperty:



  //    
// 摘要:
// 标识System.Windows.Controls .TextBox.Text依赖属性。
//
< span class =c ode-comment> // 返回:
// System.Windows.Controls.TextBox.Text依赖项属性的标识符。
public static readonly DependencyProperty TextProperty



或者只需点击F1有问题的成员,应该带你到相应的; MSDN-说明


In WPF dependency property provide the binding,styling and animation etc as read several places but How the TextBox.Text is bindable property in XAML because when we see the metadata of Text it's a normal CLR property.Is TextBox.Text property is a dependency property.

[DefaultValue("")]
[Localizability(LocalizationCategory.Text)]
 public string Text { get; set; }



What I have tried:

As I have seen the metadata of TextBox.Text it's a normal property.

解决方案

That´s totally ok, DependencyProperties almost always come with such an clr-property wrapper around the actual static representation.

Just have a look at the "propdp" VisualStudio-CodeSnippet, that generates exactly this kind of accessor.

In your case, just look out for a static readonly DependencyProperty:

//
// Summary:
//     Identifies the System.Windows.Controls.TextBox.Text dependency property.
//
// Returns:
//     The identifier for the System.Windows.Controls.TextBox.Text dependency property.
public static readonly DependencyProperty TextProperty


or simply just hit F1 on the member in question, which should take you to the according ;MSDN-Description


这篇关于textbox.text如何是XAML中的可绑定属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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