Custom Editor Styling

Grids for WPF Forum

Posted 9 years ago by Andrew Robinson
Version: 11.2.0554
Platform: .NET 4.0
Environment: Windows 7 (64-bit)


I have created a custom property editor that implements a grouped combobox based on a custom object type in our project. This works fine but the styling of the combo does not match the styling of the built-in combo that is used if, for example, a list of strings is displayed in the grid.

Can you direct me to the style to apply to the combo in the custom editor so that it visually matches your built-in editor?




P.S. I have put this in as a bug by mistake but can't see how to switch to a question. Sorry!

<DataTemplate x:Key="TagSelectionEditor_DataTemplate">
                <CollectionViewSource Source="{Binding StandardValues, RelativeSource={RelativeSource AncestorType={x:Type propertygrid:IPropertyDataAccessor}}}" x:Key="Tags">
                        <PropertyGroupDescription PropertyName="ParentName" />
                ItemsSource="{Binding Source={StaticResource Tags}}" 
                SelectedValue="{Binding Path=Value, RelativeSource={RelativeSource AncestorType={x:Type propertygrid:IPropertyDataAccessor}}}">
                                <TextBlock Text="{Binding Name}" FontStyle="Italic" Margin="3" />
                        <TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center"/>

[Modified 9 years ago]

Comments (2)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Andrew,

I'm assuming you are using the Aero theme, where the non-editable ComboBox looks more like a button and the editable ComboBox looks more like a TextBox. If that is the case, then our default property editors set IsEditable to true. We then set IsReadOnly to true, if the list is limited to a fixed set of standard values.

So I believe if you set these two properties on your ComboBox, then it should match up.

Also I noticed you are using a ribbon:ComboBox here, but we use the native WPF ComboBox in our templates.

[Modified 9 years ago]

Actipro Software Support

Answer - Posted 9 years ago by Andrew Robinson

Thanks. That almost gets me there. I needed to set the BorderThickness to zero as well.

The only downside is that introduced another problem. Where the selected text for a combo item is bigger than the available space the selected text is right aligned when left would look better. I notice that someone else raised this in another thread so I have implemented the solution from there. I create a simple class inheriting from ComboBox (see below) and then override the OnDropDownClosed.

public class PropertyGridComboBox : ComboBox
        public PropertyGridComboBox()
            IsEditable = true;
            IsReadOnly = true;
            BorderThickness = new Thickness(0);

        protected override void OnDropDownClosed(EventArgs e)
            var textBox = (TextBox)this.Template.FindName("PART_EditableTextBox", this);
The latest build of this product (v2020.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.