Jiju John
Jiju John

Reputation: 821

Menuitem align to left in wpf

I have three MenuItems,

<MenuItem x:Name="Menu1" Header="Menu1" />
<MenuItem x:Name="LoginMenu" Header="Login" />
<MenuItem x:Name="LogoutMenu" Header="Logout" />

When application load, I changed the MenuItems (except 3rd) visibility to Hidden and when I click on Login menu item I need to change the visibility to Visible. How can I left align the menu items when changing the visibility?

Upvotes: 0

Views: 94

Answers (1)

Tomtom
Tomtom

Reputation: 9394

Instead of setting the Visibility to Hidden set it to Collapsed. So the space of the collapsed-menuitem will be free. If you set the Visibility to Hidden the space the hidden items need will be reserved.

Upvotes: 2

Related Questions