Microsoft-ui-xaml: TreeView ignore ItemTemplate HasUnrealizedChildren binded property on 3+ levels of depth

Created on 30 Aug 2019  路  17Comments  路  Source: microsoft/microsoft-ui-xaml

Describe the bug
Tree item shows expand glyph when HasUnrealizedChildren and HasChildren properties set to false

Steps to reproduce the bug

Expected behavior

Expand badge shown with respect to HasUnrealizedChildren binded property

Screenshots

Screenshot_1
Screenshot_2
Screenshot_3

Version Info

NuGet package version:
Microsoft.UI.Xaml 2.2.190822001-prerelease


| Windows 10 version | Saw the problem? |
| :--------------------------------- | :-------------------- |
| Insider Build (xxxxx) | |
| May 2019 Update (18362) | Yes |
| October 2018 Update (17763) | |
| April 2018 Update (17134) | |
| Fall Creators Update (16299) | |
| Creators Update (15063) | |


| Device form factor | Saw the problem? |
| :-------------------- | :------------------- |
| Desktop | Yes |
| Mobile | |
| Xbox | |
| Surface Hub | |
| IoT | |

Additional context

bug needs-author-feedback team-Controls

All 17 comments

Hi, anyone can review my issue, please?

It's a long holiday weekend here in the US. We'll try to take a look this week when the team is back in the office. Thanks for reporting!

@jevansaks I can provide a video proof if it's useful.

Couple of comments from looking at the repro sample project. The project is not using TreeView control. It looks like you are nesting ItemsControls and trying to get to a tree view like experience. Is there any reason why you are not using the TreeView control from microsoft-ui-xaml? That will take care of the nesting for you and help you avoid a whole bunch of this code. Essentially it looks like you are writing your own tree view...

There is also multi level navigation view feature in works which may or many not be what you are looking for. https://github.com/microsoft/microsoft-ui-xaml/issues/79

Hi, @ranjeshj . You need to revert to this commit to check tree view. I tried to use TreeView, but TreeView limited with selection functionality and not provide SelectedItem functionality

Can you use TreeView.SelectedNodes (https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.treeview.selectednodes) ? What specifically are you trying to do that is not supported by tree view control ?

@ranjeshj TreeView does not allow you to select or reset selected items. But the problem I reported was not a functionality limitation but an incorrect display of the expand icon. I can create a simple project that will contain only this problem.

Yes please. If you can share a repro project which shows the tree view issue, that would be helpful. Thanks.

I tried to use TreeView, but TreeView limited with selection functionality and not provide SelectedItem functionality

We just added some new selection APIs recently, check this out https://github.com/microsoft/microsoft-ui-xaml-specs/pull/31/files?short_path=81ff309#diff-81ff3094337017f74d91702b19e8750c

Also, to reset selected items, I believe you can do TreeView.SelectedItems.Clear();

@ranjeshj https://github.com/stenvix/uwp-treeview-playground here code with detailed screenshots and steps to reproduce

Thanks @kaiguo but I already implemented my custom elements that works perfectly

@kaiguo @ranjeshj could you please confirm that my example is clear?

Yes. Thanks - the sample you shared shows the issue and i can reproduce it.

This does look like a bug in TreeView. I see that when items are recycled the chevron opacity is set based on the treeviewitem's hasunrealizedchildren property. However, in content mode, the item source gets set only during measure when the template is expanded. At this point, the tree view nodes ChildVectors get updated, and TreeViewNodes HasChildren changes - but that does not propagate to the TreeViewItem to update the GlyphOpacity...

I have a fix here - https://github.com/microsoft/microsoft-ui-xaml/pull/1348. Please give it a try. Thanks!

Was this page helpful?
0 / 5 - 0 ratings