WPF如何最大程度地运行WPF窗口 [英] WPF how to run a WPF window maximized

查看:67
本文介绍了WPF如何最大程度地运行WPF窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我叫Phani Kumar.我正在开发WPF应用程序.我将高度和宽度的大小指定为600 x600.在运行时,我将其最大化,窗口屏幕上的控件分散并且以不规则的方式对齐.

Hi,

My Name is Phani Kumar. I am developing a WPF application. I specified size of the height and width as 600 x 600. In the runtime when, I maximize it the controls on the window screen are scattered and are aligned in irregular manner. can anyone help to run application in maximized and minimized?

推荐答案

首先,接受我的道歉,这不是一个完整的答案.

在WPF中,窗口的工作方式与标准MDI/Winforms应用程序完全不同.如果您不指定窗口的大小,则将适合其内容.

类似地,控件将根据容器的类型调整其容器的大小.很可能您会在某处需要某种DockPanel.

您需要做的是找到一本书或在线资源以掌握WPF布局(尤其是不同的容器),因为它与WinForms有很大的不同(并且功能更强大).对不起,我无法提供更多帮助.这真的不是您尚未对此进行适当的研究"类型的回复,我真的不能在不看到您的应用程序以及您希望如何显示的情况下添加更多内容.
Firstly, accept my apologies, this will not be a full answer.

The way a window works in WPF is quite different to that of standard MDI/Winforms applications. If you don''t specify the size of the window, it will fit to its contents for example.

Similarly the controls re-size to their containers, dependant upon on the container type. Most probably you will need some kind of DockPanel somewhere.

What you need to do is find a book or online resource to get to grips with WPF layout (especially the different containers) as it is very different from WinForms (and much more powerful). I''m sorry I can''t be more helpful than this. This really isn''t a "you haven''t researched this properly" type reply, I genuinely cannot add more without seeing you application and how you want things to display.


您的HorizontalAlignmentVerticalAlignment属性全部被破坏. VS2008的部分问题在于,当您在设计器中移动内容时,它会根据您想做的事情更改这些属性.我不知道VS2010是否仍会执行此操作,但是如果执行此操作,我不会感到惊讶.

您必须返回并手动将它们设置为所需的值,然后记住不要在设计器中用鼠标四处移动.我知道,这很麻烦,但这就是我们的负担.
Your Margin, HorizontalAlignment, and VerticalAlignment properties are all whacked out. Part of the problem with VS2008 is that when uyou move stuff around in the designer, it CHANGES those properties for based on what it THINKS you want to do. I don''t know if VS2010 still does this, but I wouldn''t be surprised if it did.

You have to go back and MANUALLY set them to the desired values, and then remember not to move things around with the mouse in the designer. I know, it''s a pain in the a*s, but such is the burden we bear.


这篇关于WPF如何最大程度地运行WPF窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆