简体   繁体   English

具有自定义属性的扩展WPF工具包PropertyGrid

[英]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类的某些类相关联的两个属性(例如NameAge 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. 而且您的NameAge是字符串/整数类型。因此,如果将对象作为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.

相关问题 扩展的WPF工具包PropertyGrid PasswordEditor - Extended WPF Toolkit PropertyGrid PasswordEditor WPF扩展工具包PropertyGrid-组成SelectedObject - WPF Extended Toolkit PropertyGrid - Compose SelectedObject 扩展的WPF工具包PropertyGrid IsExpandable模板 - Extended WPF Toolkit PropertyGrid IsExpandable Template 将ViewModel直接绑定到扩展WPF工具包PropertyGrid - Binding a ViewModel directly to an Extended WPF Toolkit PropertyGrid 如何使用 C# 中的另一个(嵌套)编辑器为扩展 WPF 工具包 PropertyGrid 创建自定义属性编辑器? - How to create a custom property editor for Extended WPF Toolkit PropertyGrid with another (nested) editor in C#? PropertyGrid(扩展WPF工具包)中没有xaml的多行字符串? - Multi-line string in PropertyGrid (Extended WPF toolkit) without xaml? WPF 扩展工具包 PropertyGrid - 默认展开所有属性 - WPF Extended Toolkit PropertyGrid - Expand all properties by default WPF扩展工具包PropertyGrid DateTime属性更新问题 - WPF extended toolkit PropertyGrid DateTime property updating issue WPF Xceed PropertyGrid显示“ Xceed.Wpf.Toolkit.PropertyGrid.Attributes.Item”,而不是实际的DisplayName - WPF Xceed PropertyGrid showing “Xceed.Wpf.Toolkit.PropertyGrid.Attributes.Item” instead of the real DisplayName WPF扩展工具包:自定义datetimepicker时间格式 - Wpf Extended Toolkit: custom datetimepicker time format
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM