Editors and tooltips

Editors for WPF Forum

Posted 9 years ago by Rick Edwards - UK
Version: 10.1.0522
Avatar
Hi,

we're using the Actipro editors with the Property Grid and I'm trying to set up the display of errors usign tooltips for editors such as the DoublePropertyEditor. Now I can set a style on a textbox like so


    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <Border BorderBrush="Red" BorderThickness="1">
                        <AdornedElementPlaceholder />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors).CurrentItem, Converter={StaticResource ErrorContentConverter}}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

and this works fine for textboxes but does not display the tooltip for the DoublePropertyEditor. If I change the above target type to point to the DoublePropertyEditor then it throws an error stating that tooltip is not a property of the editor.

Is there a general way to apply the above error styling to all Actipro editors used in the property grid?

Thanks

Rick Edwards

Comments (1)

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

The DoublePropertyEditor isn't a control, it's just a mapping that ties properties of type Double or Double? to the DoubleEditBox. So you'd need to create an implicit Style for "editors:DoubleEditBox".

There isn't a general or generic way to apply the same ErrorTemplate to all the controls in the PropertyGrid, or any WPF control for that matter. You might be able to override it globally using code-behind though, but you couldn't apply the Style trigger globally. To change the ErrorTemplate globally, you'd need to override the metadata for Valudation.ErrorTemplateProperty for the Control type, using a custom DataTemplate as the default value.


Actipro Software Support

The latest build of this product (v2019.1 build 0682) was released 28 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.