Page 1 of 1

UIElement::IsVisibleProperty defaults to true

Posted: 23 Jul 2021, 17:51
by steveh
Hi guys,

I thought I'd post a question just to see if this is the intended flow as I'm not sure.

What I have is a UserControl which is collapsed by default:

- Window
-- User Control <-- Collapsed by default
--- ListBox <-- Visible


When I get the ListBox, I test the IsVisible property and it thinks it's visible. The reason for this is because the UserControl is collapsed it is not part of the visual tree, and the IsVisible property is updated whenever the visual element is connected to the tree.

This means that until I make the UserControl visible, the IsVisible will return me the incorrect result. I've fixed this locally by checking:

if (ListBox::IsConnectedToView() && ListBox::GetIsVisible())

But I'm not sure if this is the correct thing to do. I would expect that if something is not connected to a view then GetIsVisible should return false.

Again, I'm not sure if this is a bug per se, just a little oddity. I have a workaround for now so it's not affecting me, I just thought I would check to make sure this is expected behaviour.

Cheers,

-Steven

Re: UIElement::IsVisibleProperty defaults to true

Posted: 23 Jul 2021, 18:18
by sfernandez
This is a bug, I just checked with WPF and the default value for that property is false.
Could you please report it in our bugtracker?

Re: UIElement::IsVisibleProperty defaults to true

Posted: 23 Jul 2021, 21:07
by steveh