Visual Studio 调试器循环遍历 XAML ListView 的 C# 属性获取器

Visual Studio debugger loops through C# property getters for XAML ListView

提问人:Aleksandar 提问时间:10/25/2023 更新时间:10/25/2023 访问量:30

问:

我正在尝试调试我的 WPF,但每次我开始调试调试器时,调试器都会循环访问列表(XAML 中的 ListView)的对象属性,尽管单步执行。有什么方法可以防止这种情况发生吗?enter image description here

enter image description here

enter image description here

XAML:

<ListView
    Name="lstMovies"
    Grid.Row="1"
    Grid.Column="1"
    FlowDirection="LeftToRight"
    ItemsSource="{Binding Movies}"
    SelectedItem="{Binding CurrentMovie, Mode=TwoWay}"
    SelectionChanged="lstMovies_SelectionChanged"
    SelectionMode="Single">
    <ListView.View>
        <GridView>
            <GridView.Columns>
                <!--  COLUMN WIDTHS FITTED WITH AUTO AND MEASURED WITH PowerToys  -->
                <GridViewColumn
                    Width="235"
                    DisplayMemberBinding="{Binding Path=Title}"
                    Header="Title" />
                <GridViewColumn
                    Width="65"
                    DisplayMemberBinding="{Binding Path=Genre}"
                    Header="Genre" />
                <GridViewColumn
                    Width="76"
                    DisplayMemberBinding="{Binding Path=RunningTime}"
                    Header="Running Time" />
                <GridViewColumn
                    Width="109"
                    DisplayMemberBinding="{Binding Path=Instructor}"
                    Header="Instructor" />
                <GridViewColumn
                    Width="93"
                    DisplayMemberBinding="{Binding Path=PremiereDate}"
                    Header="  Premiere Date  " />
            </GridView.Columns>
        </GridView>
    </ListView.View>
</ListView>
C# XAML 调试

评论

1赞 Rand Random 10/25/2023
这可能会有所帮助:stackoverflow.com/questions/2672996/...
1赞 Aleksandar 10/25/2023
@RandRandom 尝试取消选中该选项并再次运行它 - 调试器似乎仍然遍历 ListView 中所有对象的每个属性。我怀疑它是由 XAML 或其他原因引起的,因为它发生在代码块完成后

答: 暂无答案