wpf自定义textbox控件,继承UserControl;怎样定义Text依赖属性实现双向绑定,就像Textbox控件的Text属性一样。我的代码:publicStri...
wpf自定义textbox控件,继承UserControl;怎样定义Text依赖属性实现双向绑定,就像Textbox控件的Text属性一样。我的代码:
public String Text
{
get { return (String)GetValue(TextProperty); }
set { SetValue(TextProperty, value); }
}
// Using a DependencyProperty as the backing store for Text. This enables animation, styling, binding, etc...
public static readonly DependencyProperty TextProperty =
DependencyProperty.Register("Text", typeof(String), typeof(ListTextBox),new PropertyMetadata(""));