界面没有内容显示,求各位指导

listView.ItemsSource = stringList;里有数据,但是界面没有显示内容,之前用的是另一种控件,但都是一样的问题

 public partial class Screen : Window
    {
        public Screen()
        {
            InitializeComponent();
        }

        public Screen(List list)
        {

            InitializeComponent();

            // 将 Sport_Mileage_Chip 对象列表转换为一个包含各个对象信息的字符串列表
            List<string> stringList = new List<string>();
            foreach (Sport_Mileage_Chip item in list)
            {
                stringList.Add($"Sport: {item.ChipNumber}, Mileage: {item.turnSum}");
            }

            // 将字符串列表设置为 ListView 控件的 ItemsSource 属性
            listView.ItemsSource = stringList;
        }
    }


```xaml
<Window x:Class="Record.View.Screen"
        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:Record.View"
        mc:Ignorable="d"
        Title="Screen" Height="450" Width="800"  >
    <Grid>
        <ListView x:Name="listView">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}" Foreground="Black"/>
                DataTemplate>
            ListView.ItemTemplate>
        ListView>
    Grid>
Window>



```

不知道你这个问题是否已经解决, 如果还没有解决的话:

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^

看了你的代码带参数的构造函数我不知道你哪里调用的

ListView 控件的 XAML 标记是正确的,并且数据绑定也已正确设置。请考虑是其他因素导致你的界面没有内容显示。当然你没有提供相关部分的信息。这里的意见仅供参考。比如你可以将ListView设置为其他颜色如何看ListView在表单上是否可见。还有就是你需要自己打断点看导致是否有数据传过来。