Skip to content

ValidatesOnExceptions=True causes ValidationErrorTemplate to jump around #4120

@pfattisc

Description

@pfattisc

Describe the bug

Setting ValidatesOnExceptions=True on a binding causes the ValidationErrorTemplate to jump to the window title in case of exceptions.

Steps to reproduce

  1. Go to the MahAppsDemo project
  2. Add ValidatesOnExceptions=True to the enabled TextBox with ValidationError (that binds to IntegerGreater10Property) on the TextExamples.xaml view. here
  3. Start the demo
  4. Enter the TextBox and provoke an error by hitting the spacebar (entering a space instead of a number).

Expected behavior

The ValidationErrorTemplate should not follow kriss kross and stop jumping around :-P

Possible Fix

I think CustomValidationPopup.ScrollViewer_ScrollChanged is the culprit. The call to RefreshPosition() should be inside of the if-statement that checks whether scrolling actually happened. After I removed that line the jumping stopped. And since the scrollchanged event is fired even if the scrollposition didn't change, I think RefreshPosition() can be safely moved into that if-statement.

Environment

MahApps.Metro version: v2.0.0
Windows build number: Win10 1607
Rider 2021.1.3
Target Framework: .Net v4.7.2

Screenshots

CustomValidationPopup_Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions