dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
7.08k stars 1.17k forks source link

ListView missing in .NET 9 Fluent theme #10076

Open antikmozib opened 1 day ago

antikmozib commented 1 day ago

Description

Image The above screenshots represent the same application and code except that the first one is built with .NET 9 using Fluent theme and the second one is built with .NET 8.

I am wondering if I am missing something here or if it's a bug.

Thank you


MainWindow.xaml

<Window x:Class="WpfApp1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfApp1"
        mc:Ignorable="d"
        Title="MainWindow"
        Height="200"
        Width="300">
    <Grid>
        <ListView ItemsSource="{Binding Cars}">
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Make"
                                    DisplayMemberBinding="{Binding Path=Make}" />
                    <GridViewColumn Header="Model"
                                    DisplayMemberBinding="{Binding Path=Model}" />
                </GridView>
            </ListView.View>
        </ListView>
    </Grid>
</Window>

MainWindow.xaml.cs

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();

        DataContext = new MainViewModel();
    }
}

MainViewModel.cs

public class MainViewModel
{
    public class Car
    {
        public string? Make { get; set; }

        public string? Model { get; set; }
    }

    public ObservableCollection<Car> Cars { get; set; } = [];

    public MainViewModel()
    {
        Cars.Add(new Car() { Make = "Toyota", Model = "Corolla" });
        Cars.Add(new Car() { Make = "Honda", Model = "Civic" });
    }
}

Reproduction Steps

Create a WPF project with .NET 9 + Fluent theme and add a ListView with some column headers.

Expected behavior

ListView in Fluent style.

Actual behavior

No ListView.

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

.NET 9.0.100 VS 2022 17.12 Windows 11 24H2 x64

Other information

No response

lindexi commented 1 day ago

@antikmozib Thank you for your feedback. And this is the known issues. See #8753