Reputation: 111
I have a quick question regarding visibility of windows in an application. According to... http://msdn.microsoft.com/en-us/library/system.windows.visibility.aspx (its short)
When a window is collapsed no space is reserved for the window in layout. When a window is hidden space is reserved for the window in layout.
I'm confused here, what is the layout referring to? Is it referring to window space?
Upvotes: 4
Views: 9766
Reputation: 2950
Here's an illustration:
<Grid>
<TabControl>
<TabItem Header="Visible"></TabItem>
<TabItem Visibility="Hidden" Header="Hidden">Hidden</TabItem>
<TabItem Visibility="Hidden" Header="Hidden">Hidden</TabItem>
<TabItem Visibility="Hidden" Header="Hidden">Hidden</TabItem>
<TabItem Header="Visible"></TabItem>
<TabItem Header="Visible"></TabItem>
<TabItem Header="Visible"></TabItem>
</TabControl>
</Grid>
Will render this:
And this XAML:
<Grid>
<TabControl>
<TabItem Header="Visible"></TabItem>
<TabItem Visibility="Collapsed" Header="Collapsed">Collapsed</TabItem>
<TabItem Visibility="Collapsed" Header="Collapsed">Collapsed</TabItem>
<TabItem Visibility="Collapsed" Header="Collapsed">Collapsed</TabItem>
<TabItem Header="Visible"></TabItem>
<TabItem Header="Visible"></TabItem>
<TabItem Header="Visible"></TabItem>
</TabControl>
</Grid>
Will render this:
So, Collapsed
will not save the space, whereas Hidden
will.
Upvotes: 9
Reputation: 855
Layout is basically the overall placing of your controls within the form so if its collapsed that means it would be abscent in the UI and its place would be utilized by other controls however when its hidden it would be just invisible to user however its place can not be occupied by any other control its just not visible to user.
Upvotes: 0
Reputation: 26370
The visibility does not only refer to windows, but all controls. If you use a layout that automatically places its child controls that it makes a difference if you use 'hidden' or 'collapsed'. 'hidden' means that the layout control still "reserves space" for it when arranging its children, while 'collapsed' means that the layout is not reserving any space for it.
Upvotes: 0
Reputation: 938
No, its referring to the whole window you are looking at.
Lets say, you have at the top of the screen a Red Block (20px height) and below the Red Block you have a title.
Hidden: The Red Block is NOT visible, but the space it normally reserves, is still reserved, meaning the Title is is 20px away from the top of the screen
Collapsed: The Red Block is NOT visible together with the reserved space (the 20px height), meaning the Title is located at the top of the screen
Upvotes: 1