Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
How to customize validation message box
posted

Hi,
I have a validation like below in xamDataGrid:

<ig:Field Name="EmailAddress" Label="{tp:Localize FieldLabelEmail}">
    <ig:Field.Settings>
        <ig:FieldSettings EditorType="{x:Type Editors1:XamTextEditor}">
            <ig:FieldSettings.EditorStyle>
                <Style TargetType="{x:Type Editors1:ValueEditor}">
                    <Style.Setters>
                        <Setter Property="ValueConstraint">
                            <Setter.Value>
                                <Editors1:ValueConstraint MinLength="5" RegexPattern="^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([;.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$" />
                            </Setter.Value>
                        </Setter>
                        <Setter Property="InvalidValueBehavior" Value="RetainValue" />
                    </Style.Setters>
                    <Style.Triggers>
                        <Trigger Property="IsValueValid" Value="false">
                            <Trigger.Setters>
                                <Setter Property="BorderBrush" Value="Red" />
                            </Trigger.Setters>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ig:FieldSettings.EditorStyle>
        </ig:FieldSettings>
    </ig:Field.Settings>
</ig:Field>

I'm trying to figure it out how to customize validation error message box (replace by my own implementation), for now, I could just turn off the

original message box.

Thanks,
Marcin (The Gravedigger)

  • 138253
    Offline posted

    Hello,

     

    It has been a while since you have made your post, in case you still need support I will be glad to assist you further. I suppose the other community members can benefit from this answer as well. So I have been looking through your post and I sample project for you where I show a MessageBox, but you can show a custom Window, too. I just handle the XamTextEditor’s EditModeEnding event and check if the value is valid if not the message shows.

     

    Feel free to write me if you have any other questions.

    xamDataGridCustomVAlidationErrorMessage.zip