editors:DoubleEditBox with ComboBoxValueTemplateKey style

Editors for WPF Forum

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was before this thread was created.
Posted 1 month ago by Daniel Constantin
Version: 16.1.0634
Avatar

Hello,

How can I use the propgrideditors:DoublePropertyEditor inside a property grid for a double value ?

I tried with:

<propgrid:PropertyEditorsModifier x:Key="{x:Static propgrid:BuiltinEditors.PropertyEditorsModifierKey}">
  <propgrid:PropertyEditorsModifierActionAdd>
    <propgrideditors:DoublePropertyEditor PropertyType="{x:Type system:Double}"/>
  </propgrid:PropertyEditorsModifierActionAdd>
</propgrid:PropertyEditorsModifier>

inside the resources and also with:

<propgrid:PropertyGrid.PropertyEditors>
  <propgrideditors:DoublePropertyEditor SpinnerVisibility="Visible" PropertyType="{x:Type system:Double}"/>
</propgrid:PropertyGrid.PropertyEditors>

but I could not make it work.

And also if I want to have a more complex PropertyGridCategoryItem with lets say 2 comboboxes, can I find somewhere the property grid styles for comboboxes, buttons, etc or I need to write the styles myself ?

Any help is greatly appreciated.

Kind regards,

Daniel

Comments (11)

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

Per the "PropertyGridIntegrationInterop" QuickStart, in the older 2016.1 API, either of those things should generally work.  Other than I don't believe you need to specify PropertyType on the since DoublePropertyEditor should do the Double recognition automatically.

As for the default styles, I believe your company has a WPF Studio license.  Whoever has access to the Actipro account can log in and download the default styles/templates from there.  The default styles for the property editors are in the PropertyGrid folder hierarchy within PropertyEditors.xaml. 

FYI, the newer PropertyGrid control found in the Grids product in the current version improved PropertyGrid performance by completely restructuring the internals of the control and making the DataTemplates used for property editors much simpler.


Actipro Software Support

Posted 1 month ago by Daniel Constantin
Avatar

Hello!

We are in the process of updating our licenses so I am glad to hear that about the new property grid :)

An example with the new property grid having inside some property editors and maybe a custom one with more controls would save a lot of time for me so if you have one it would be great.

Kind regards,

Daniel

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

In the new version, the PropertyGridCustomPropertyEditor QuickStart shows an implementation of two custom property editors.  

As for the DoublePropertyEditor, that all should work the same way in the new version too.


Actipro Software Support

Posted 1 month ago by Daniel Constantin
Avatar

Hello!

Also another thing which I need to do is  that I want to put a representation of a matrix inside a PropertyGridPropertyItem. So basically I need to add like a datagrid with double values and to be clear to add also x,y,z as column headers and the same x,y,z, as row headers.

Kind regards,

Daniel

Posted 1 month ago by Daniel Constantin
Avatar

I just found the custom property editor. I think it might work

Posted 1 month ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

Yes, with a custom property editor, you could put any WPF controls in the property value area.  You certainly could add a DataGrid like UI that you have when this matrix property is detected.  The property editor lets you designate a DataTemplate where you put the controls in, and the DataContext passed to that DataTemplate is the IPropertyModel.  This makes it easy to bind your controls.


Actipro Software Support

Posted 28 days ago by Daniel Constantin
Avatar

Hi,

I have a data grid as thevalue template for a PropertyGridPropertyItem. the problem is that I cannot see the entire data grid. The PropertyGridPropertyItem vertical lenght seems to be somehow defined somewhere.

How can change the PropertyGridPropertyItem to contain larger controls?

Posted 27 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

We don't define a height, so it should use the height of the content.  It could be that your data grid isn't measuring itself to be taller. 

For instance if I open our custom property editor sample and put a Height="100" on the root control in the property editor DataTemplate, I see that height at run-time fine.  Maybe try setting a Height on your data grid control.


Actipro Software Support

Posted 27 days ago by Daniel Constantin
Avatar

Hi,

I made a minor mistake related to the height and I manage to make it work.

I am curious..

Can I merge a name cell and a value cell for displaying my datagrid without losing space on the left side or if this does not work, to set the weight of the name cell to be '*' and the value cell to be '2*'. I am trying to make the value cell weight larger than the name cell.. maybe twice as large if it's possible.

Posted 26 days ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Daniel,

Merging cells is possible, but a bit tricky.  Basically each row in the PropertyGrid is represented by a PropertyGridItem "container".  The data context of the row and the cells that end up in the row is the IDataModel instance for that row's property/category/category editor. 

We have a PropertyGridItemStyleSelector instance in the PropertyGrid.ItemContainerStyleSelector property that basically chooses between three different Styles by default for PropertyGridItem.  One is for properties, one is for categories, and one is for category editors.

You could make a class that inherits PropertyGridItemStyleSelector and in its SelectStyle method, see if the "item" is an IPropertyModel for your data grid property.  If so, then have it return a custom Style for a PropertyGridItem that in its Template has a PropertyGridItemContentPanel that wraps the DataGrid.  The PropertyGridItemContentPanel ensures everything is indented properly per the nesting level.  Bind the DataGrid like you do in your current property editor DataTemplate.

On the other hand, if you want to change column sizes instead, those can be set on the PropertyGrid.Columns collection.  It should have two columns in it.  Both columns have various MinWidth, Width, and MaxWidth settings.  You'd have to alter those as you would like.


Actipro Software Support

Posted 25 days ago by Daniel Constantin
Avatar

Thanks a lot!!

Add Comment

Please log in to a validated account to post comments.