Skip to content

WinUI 3 TreeView SelectionMode="Multiple" and TreeViewItem Visibility="Collapsed" causes crash #8887

Open

Description

Describe the bug

The following TreeView causes a crash

<TreeView
  SelectionMode="Multiple"
  ItemsSource="{x:Bind TreeViewItems}">
  <TreeView.ItemTemplate>
      <DataTemplate x:DataType="local:TreeNode">
        <TreeViewItem Visibility="Collapsed"/>
      </DataTemplate>
    </TreeView.ItemTemplate>
</TreeView>

Steps to reproduce the bug

  1. Clone the example at https://github.com/alataffective/WinUI3TreeViewCrash
  2. Run the example

The application crashes.

This appears to be due to the combination of TreeView SelectionMode="Multiple" and TreeViewItem Visibility="Collapsed". Changing the TreeViewItem Visibility="Visible" or the TreeView SelectionMode to another value, the application no longer crashes.

Expected behavior

The application should not crash.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.0: 1.4.230822000

Windows version

No response

Additional context

Windows 10 Version 22H2 (OS Build 19045.3448)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions