none
WPF windows adjust by screen resolution

    Question

  • I am developing a WPF application in C#.net. I have a question regarding Window adjustment. I have some controls in window. When i run application the adjustment looks fine but when i maximize the window, controls overlapped. Like i have controltab and viewbox controls in window. when i maximize the window both controls stretch at left side. I want that Both controls stretch but doesnt overlap. Both controls are streching automatically as they are in GRID.

    Thanks in advance.

    /Zeeshan

    Wednesday, May 19, 2010 7:01 AM

Answers

  • Try to use Grid and place all your controls in it and grid will automatically adjust its children based on resolution. In grid, You need to give columns and rows.

    Wednesday, May 19, 2010 8:03 AM
  • Hi Zeeshan,

     

    if you havent already tried it, give <Viewbox > a go.

     

    it scales everything inside it to the size of the viewbox.

     

    There is a gotcha though.  if you set the dimensions of the viewbox, then it doesnt work, so make sure your viewbox sits inside a grid or the controls main window and have that parent scale to fit the area you want to fill.

     

    Cheers

    Anton

     

     

     

    Thursday, May 20, 2010 2:36 AM

All replies

  • Try to use Grid and place all your controls in it and grid will automatically adjust its children based on resolution. In grid, You need to give columns and rows.

    Wednesday, May 19, 2010 8:03 AM
  • Thank you Ikram for your reply.

    I am using grid. And i have added 2 TabControls. First is with 3 tabs and second is with 2 tabs. When i increase the windowsize at run time by mouse both controls increase at right side and the first control windows comes behind second tab control window and second tab control window only increase to the border of Main window.

    I want that both tabcontrols increase and decrease by windowsize but dont overlap. 

    Wednesday, May 19, 2010 2:48 PM
  • Can you show the xaml here? Perhaps you are setting margin or some other related property...

    Wednesday, May 19, 2010 3:19 PM
  • Hi Zeeshan,

     

    if you havent already tried it, give <Viewbox > a go.

     

    it scales everything inside it to the size of the viewbox.

     

    There is a gotcha though.  if you set the dimensions of the viewbox, then it doesnt work, so make sure your viewbox sits inside a grid or the controls main window and have that parent scale to fit the area you want to fill.

     

    Cheers

    Anton

     

     

     

    Thursday, May 20, 2010 2:36 AM
  • Thanks Ikram. I have solved the problem :). Thanks for ur reply.

    Thursday, May 20, 2010 12:37 PM
  • Hi Anton!

    Thank you for your reply. Problem has now been solved.

    Cheers :)

     

    Thursday, May 20, 2010 12:40 PM