Solved

WPF Dock Panel - Stretch file menu

Posted on 2013-06-23
5
887 Views
Last Modified: 2013-06-23
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
0
Comment
Question by:tommym121
  • 3
  • 2
5 Comments
 

Author Comment

by:tommym121
ID: 39269212
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
 
LVL 63

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39269294
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
 

Author Comment

by:tommym121
ID: 39269339
Thanks.  I set the width too.
0
 

Author Closing Comment

by:tommym121
ID: 39269340
Thanks
0
 
LVL 63

Expert Comment

by:Fernando Soto
ID: 39269343
Not a problem tommym121, glad I was able to help. ;=)
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question