none
Resizing WebBrowser control to fit grid

    Question

  • New to Silverlight so sorry if this is a newbie question.

    I have a SL5 OOB app and I am showing a WebBrowser control in a popup window.  The WebBrowser is in a grid cell and all I want to do is have the WebBrowser entirely fill the cell.  When I specify the height/width, everything works OK but it just doesn't look like I want it to.

    I've tried different layout controls but they don't seem to make much difference.  I've also tried handling the SizeChanged event and force the WebBrowser size to the size of the grid minus a little for margin, but that just causes the app to crash.  I couldn't trap the system exception, so I don't know why.

    I've heard the WebBrowser is not your standard SL control and has some quirks.  Any suggestions will be greatly appreciated.

    thanks,
    randy

    Monday, April 30, 2012 10:56 AM

Answers

  • Hi brattonr,

    When control is not given fixed Width or Height, they will auto fit its container.

    So please just leave WebBrowser's Width and Height blank and check to see if it is what you want.

     

    Best Regards,

    Wednesday, May 02, 2012 5:17 AM
  • hi,

    U have to specify the width and height some where only once better u specify height and width for ur outer grid the set the webbrowser control height and width auto , it will take the height and width of ur grid .

    Hope it will help u

    Thursday, May 03, 2012 2:19 AM

All replies

  • Hi brattonr,

    When control is not given fixed Width or Height, they will auto fit its container.

    So please just leave WebBrowser's Width and Height blank and check to see if it is what you want.

     

    Best Regards,

    Wednesday, May 02, 2012 5:17 AM
  • hi,

    U have to specify the width and height some where only once better u specify height and width for ur outer grid the set the webbrowser control height and width auto , it will take the height and width of ur grid .

    Hope it will help u

    Thursday, May 03, 2012 2:19 AM