Reputation: 639
I have a WPF form in which I have 4 user controls within a tab control. I change the visibility of the user control as i move forward. For eg: UC1 visible is true, UC2,UC3,U4 : visibility is false then onlick of a next button in UC1, UC1 becomes visible false and UC3 visible true.And so on.
<TabControl HorizontalAlignment="Left" >
<TabItem Header="Test">
<StackPanel Orientation="Horizontal" >
<View:UC1 />
<View:UC2 />
<View:UC3 />
</StackPanel>
</TabItem>
</TabControl>
UC1 and Uc2 works,However when i make uc3 visible the control moves far right and there is space in between. I dont get what i am doing wrong here.
Upvotes: 0
Views: 791
Reputation: 15860
If there is some space between the control and you can see nothing. That means that there is something present. Either it is
Padding
Margin
Hidden Control.
To minimize this, you should use the Collapsed property of the Visibility.
Use this,
Visibility = Visibility.Collapsed;
for your UC3 element. It would be like, there is no such control between the controls.
Upvotes: 1