WPF 中,如果我自己的控件想有一些属性能像标准控件那样绑定数据,应该怎么做。

qwedcxza 2009-05-13 09:11:21
自己做的控件,怎样能让属性支持数据绑定。
...全文
131 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
富莱工作室 2009-05-14
  • 打赏
  • 举报
回复
注册依赖属性

public int MyProperty
{
get { return (int)GetValue(MyPropertyProperty); }
set { SetValue(MyPropertyProperty, value); }
}

// Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc...
public static readonly DependencyProperty MyPropertyProperty =
DependencyProperty.Register("MyProperty", typeof(int), typeof(ownerclass), new UIPropertyMetadata(0));
zouzedong 2009-05-14
  • 打赏
  • 举报
回复
在自定义控件里面取传过来的Table数据·
zouzedong 2009-05-14
  • 打赏
  • 举报
回复
传个dataTable过去

13,347

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 .NET技术前瞻
社区管理员
  • .NET技术前瞻社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧