[英]Extended WPF Toolkit PropertyGrid with Custom Attributes
I've searched the web for some introductory tutorial about the Extended WPF Toolkit PropertyGrid ( http://wpftoolkit.codeplex.com ) and custom attributes but didn't find. 我在网上搜索了一些有关扩展WPF工具包PropertyGrid( http://wpftoolkit.codeplex.com )和自定义属性的入门教程,但没有找到。 I've also downloaded the source code with the samples inside but that didn't help either. 我还下载了带有示例的源代码,但这也没有帮助。 I'm a beginner with WPF so i might be missing something simple here. 我是WPF的初学者,所以我可能在这里缺少简单的东西。 What i want to do is to create a simple Property Grid with some custom attributes. 我想要做的是用一些自定义属性创建一个简单的属性网格。 Does someone have a code snippet of something simple like a Property Grid with two attributes like Name
and Age
that are associated with some class like Person
. 有人是否拥有诸如属性网格之类的简单代码片段,该代码片段具有与诸如Person
类的某些类相关联的两个属性(例如Name
和Age
。 I've already tried the snippet that they provide in the PropertyGrid documentation page on Codeplex but i couldn't get it to work. 我已经尝试了它们在Codeplex上的PropertyGrid文档页面中提供的代码段,但无法正常工作。 I've managed to put the Property Grid appear on the UI, but that's all, no custom attributes. 我设法将属性网格显示在UI上,但是仅此而已,没有自定义属性。
And your Name
, Age
are string/int types.. So if you assign your object as SelectedObject
to PropertyGrid- it must do just fine. 而且您的Name
, Age
是字符串/整数类型。因此,如果将对象作为SelectedObject
分配给PropertyGrid,则必须做的很好。 For example here is my code where i show application settings as property grid to the user: 例如,这是我的代码,其中我向用户显示应用程序设置作为属性网格:
wpf : wpf :
<extToolkit:PropertyGrid
Name="PropertyPanel"
IsManipulationEnabled="True"></extToolkit:PropertyGrid>
codebehind : 代码隐藏 :
PropertyPanel.SelectedObject = Properties.Settings.Default;
PopertyGrid assigns templates automatically, depending on property type. PopertyGrid会根据属性类型自动分配模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.