WPF Dock Panel - Stretch file menu

I try to create a WPF Menu and dock it on top in Top WPF DockPanel.   However when I stretch the window, the menu is in the middle top of the window rather than stretch across  the length of the window.  How can I make the menu to stretch across the window.
Capture.JPG
tommym121Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Fernando SotoConnect With a Mentor RetiredCommented:
Hi tommym121;

What happens when you do this instead of the line you are using.

 menu.HorizontalAlignment = HorizontalAlignment.Stretch;

Also are you setting the Height and Width on the Menu control?
0
 
tommym121Author Commented:
I forget to attach the code. This is the code:

           Menu menu= new Menu();
            menu.HorizontalAlignment = HorizontalAlignment.Left | HorizontalAlignment.Stretch; ;
            menu.VerticalAlignment = VerticalAlignment.Top;

            DockPanel.SetDock(menu, Dock.Top);
0
 
tommym121Author Commented:
Thanks.  I set the width too.
0
 
tommym121Author Commented:
Thanks
0
 
Fernando SotoRetiredCommented:
Not a problem tommym121, glad I was able to help. ;=)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.