dotnet / dotnet/wpf

WPF TabControl bug

Open
#6,143 8 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity2.visualstudio.com/t/WPF-TabControl-bug/1111453)._

---
There’s a WPF bug with Toolbars inside TabControls, starting with .NET Framework 4.7.1 and it also affects .NET Core. Location of bug in MSFT code, and workaround at bottom.

**Repro**:

1. Create a WPF Application for .NET Framework 4.7.1 or later, or .NET Core 3.0 or later.
2. Paste this into the body of MainWindow.xaml:

```











```

3. Run (Debug)
4. Select “Second Tab”
5. Select “First Tab”
6. Click “First Button”

**Expected**: First Tab should remain selected

**Actual**: Second Tab is re-selected. This does not happen in .NET Framework 4.7 or earlier.

**Note:** This bug started with the changes in DDVSO 208019, "change SelectedContent and focus before raising SelectionChanged" and probably relates to this code:

![](https://aka.ms/dc/file?name=B1d80c057ece04add877c807bef74d929637494580152737593_b5ljc.png&tid=1d80c057ece04add877c807bef74d929637494580152737593)
**A workaround** is to disable this new behavior by adding an app.config file and setting SelectionPropertiesCanLagBehindSelectionChangedEvent as shown [here](https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/retargeting/4.7-4.7.1#selector-selectionchanged-event-and-selectedvalue-property).

---
### Original Comments

#### Feedback Bot on 7/14/2020, 11:32 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

#### John on 8/22/2020, 06:29 AM:

Any progress? This broke our UI. Thank you.

#### Megan Tidd on 9/10/2020, 09:24 PM:

@Feedback Bot What is the current status of this bug?

#### John on 10/1/2020, 01:07 AM:

Is this being worked on? Thank you.
@Feedback Bot

#### Feedback Bot on 10/30/2020, 02:31 PM:

I detected that this issue hasn’t received a lot of activity, votes, or comments in the past 90 days. Based on this, the issues severity and affected area, it’s my experience that this issue is unlikely to get fixed. To improve the situation, consider following best practices for quality problem reports, and giving us more details on how this issue is impacting you.

#### Fiona Niu[MSFT] on 1/21/2022, 03:43 PM:

Thank you for taking the time to log this issue! Did you still reproduce this issue in the latest stable version of Visual Studio installed from https://visualstudio.microsoft.com/downloads ?

If so, could you please provide a sample solution that has this problem so that we can conduct further research?


We look forward to hearing from you!

#### John on 1/26/2022, 01:18 AM:

Sure, open this solution and start at step 3 of repro: TabControlBug.zip

#### Feedback Bot on 2/18/2022, 01:47 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

---
### Original Solutions
(no solutions)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.