WPF datagrid autoresize on maximize
My WPF application has a resolution of 1024x768. I have a datagrid
that fills a vertical half of the application. In higher resolutions, when I maximize I want the datagrid
to automatically resize vertically and fill the entire height. How can I do this开发者_JS百科?
you can try setting the control's vertical alignment to stretch (VeritcalAlignment="Stretch"
) so that even when your window resizes, it still fills up the vertical part of your screen.
Let me know if this works for you or you have something else in mind. :)
So if I understand your question correctly, you are asking that if your screen resolution is higher than 1024 X 768 and application is maximized you want DataGrid to fill the entire height. You should register application size change event. Inside that event you should get the current screen resolution and if the current screen resolution is greater than 1024 x 768 you can set the DataGrid height to * so that it can cover the whole available space.
精彩评论