Skip to content

FlipView SelectionChanged event firing twice since 2.4.0 #4012

@GSDragoon

Description

@GSDragoon

Describe the bug

Since MahApps.Metro 2.4.0, the FlipView SelectionChanged event is firing twice. 2.3.4 is only doing this once. I have a long running task in that event and this issue is causing problems.

Steps to reproduce

  1. Add a SelectionChanged event to a FlipView with multiple items.
  2. Set a break point on that SelectionChanged method.
  3. Navigate the FlipView views/items and notice 2.3.4 only hits that method once per navigation while 2.4.0 (up to the current latest 2.4.3) triggers the method twice.

Expected behavior

The SelectionChanged event should only fire once for FlipView.

Actual behavior

From what I can tell, 2.3.4 is firing the event just for the FlipView while changes in 2.4.0 make it so the event is also triggered for the underlying ListBox control. I was looking at the OriginalSource on the SelectionChangedEventArgs. I tried setting e.Handled = true in my event, but that didn't prevent it from triggering a second time.

Environment

MahApps.Metro version: v2.4.0
Windows build number: Win10 20H2 [OS Build: 19042.685]
Visual Studio: 2019 16.8.3
Target Framework: .NET Framework 4.8, .NET Core 3.1.10 and .NET 5.0.1 (Recreated with all three)

Screenshots

N/A

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions