wpf自定义textbox控件,继承UserControl;怎样定义Text依赖属性实现双向绑定,
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("")); 展开
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("")); 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询