简体   繁体   English

Propertygrid:基于保证金目标属性创建自定义属性定义

[英]Propertygrid: create custom property definition based on Margin target property

I'm using the Extended WPF Toolkit's PropertyGrid. 我正在使用扩展WPF工具包的PropertyGrid。 For the margin target property I would like to divide it from (0,0,0,0) to four separate fields with words or arrows, similar how it is in Visual Studio. 对于边距目标属性,我想将其从(0,0,0,0)分为四个带有单词或箭头的单独字段,类似于Visual Studio中的情况。 My xaml looks like this: 我的xaml看起来像这样:

            <extToolkit:PropertyDefinition TargetProperties="Margin"/>

Current visual appearance: 当前的视觉外观:

当前的视觉外观

Desired visual appearance: 所需的视觉外观:

所需的外观

Not quite what you asked, but something easy you can do is setting the IsExpandable property to true , like so... 并不是您所要求的,但是您可以轻松地将IsExpandable属性设置为true ,就像这样...

<extToolkit:PropertyDefinition TargetProperties="Margin" IsExpandable="true" />

That forces the PropertyGrid to expand out the object at that property. 这迫使PropertyGrid扩展该属性处的对象。

However, if you want to do the editor the way you have it, you have to create a custom editor for that specific property. 但是,如果要以自己的方式进行编辑,则必须为该特定属性创建一个自定义编辑器。 You do that by associating your own templates for the editor. 您可以通过为编辑器关联自己的模板来实现。 Since it looks like something that may be reusable, I would design that as a control, then use that control as the editor. 由于它看起来可能可以重用,因此我将其设计为控件,然后将该控件用作编辑器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM