ListView column resizing breaks if there is a DataTrigger on the View property
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
We were able to reproduce an issue in which the column widths are "stuck" even though the width of the column header can still be modified (see screenshot below).
### Reproduction Steps
1. Create a new C# .NET 7 WPF project "Repro" with default settings in Visual Studio 2022.
2. Add the following code to MainWindow.xaml
```
<Setter Property="View" Value="{StaticResource FirstNameFirst}" />
<Style.Triggers>
<DataTrigger Binding="{Binding UseAlternateView}" Value="true">
<Setter Property="View" Value="{StaticResource LastNameFirst}" />
</DataTrigger>
</Style.Triggers>
```
3. Add the following code to MainWindow.xaml.cs
```
using System.Collections.Generic;
using System.Windows;
namespace Repro
{
public partial class MainWindow : Window
{
public bool UseAlternateView { get; set; } = false;
public MainWindow()
{
InitializeComponent();
this.DataContext = this;
var items = new List()
{
new { FirstName = "John", LastName = "Doe" },
new { FirstName = "Jane", LastName = "Doe" }
};
lvw.ItemsSource = items;
}
}
}
```
4. Run the application.
5. Use the mouse to increase the width of the first column.
### Expected behavior
Widening the header should also increase the width of the content.
### Actual behavior
The columns in the ListView header and the ListView content are "out of sync": The content stays at the same position, only the header column gets widened (see screenshot):

### Regression?
_No response_
### Known Workarounds
_No response_
### Impact
_No response_
### Configuration
This seems to be an old bug: We were able to reproduce it with .NET 7, .NET Core 3.1 and .NET Framework 4.8. Still, to our surprise, we did not find it documented anywhere (or we did not look hard enough).
### Other information
The `DataTrigger` is never actually triggered, but it is required for reproducing the bug. After removing the DataTrigger, the problem can no longer be reproduced.
Contributor guide
Assessment
This issue has not been assessed yet.