随笔分类 -  WPF

摘要:PropertyGrid是一个很强大的控件,使用该控件做属性设置面板的一个好处就是你只需要专注于代码而无需关注UI的呈现,PropertyGrid会默认根据变量类型选择合适的控件显示。但是这也带来了一个问题,就是控件的使用变得不是特别灵活,主要表现在你无法根据你的需求很好的选择控件,比如当你需要用Slider控件来设置int型变量时,PropertyGrid默认的模板选择器是不支持的,本文将使用一个继承自DataTemplateSelector的类实现上述功能,让你的PropertyGrid设计更加强大和灵活。 阅读全文
posted @ 2017-06-03 13:28 WCode 阅读(1486) 评论(1) 推荐(0)
摘要:/// /// 根据控件的值获取到对应的Item /// /// 最终获取到Item的具体类型 /// The element. /// The content. /// public static T FindItemByContent(this ItemsCo... 阅读全文
posted @ 2017-05-05 18:11 WCode 阅读(515) 评论(0) 推荐(0)
摘要:/// /// Clones the control. /// /// The source element. /// The dest element. public void CloneControl(UIElement sourceElement, UIElement destElement... 阅读全文
posted @ 2016-12-20 11:48 WCode 阅读(547) 评论(0) 推荐(1)