Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Center Silverlight on browser page (like this forum)
2 replies. Latest Post by TerryL on November 5, 2009.
(0)
terryl
Member
29 points
29 Posts
11-05-2009 1:02 AM |
Hi:
I've read some of the posts on howto do this. Set width = 100% in the CSS or place content in a grid with 3 columns, the middle the width I want and the first and third = *. Those don't work for me. My UserControl remains on the left hand side of the browser window no matter how wide I make it. Did these techniques quit working in SL3 or am I doing something wrong? Can someone give me a code example?
Thanks,
Terry
Sledge70
Contributor
5988 points
1,050 Posts
11-05-2009 4:19 AM |
Have you tried setting the Vertical and Horizontal Alignment of your root control to stretched?
Also, you'll need to remove Width and Height on the root or have them set to Auto.
11-05-2009 9:10 AM |
HorizontalAlignment="Stretch" fixed it. Thanks!
I also discovered I could do the following in my Loaded event:
int screenWidth = Int32.Parse( System.Windows.Browser.HtmlPage.Window.Eval( "screen.width" ).ToString() );BG_Image.Width = screenWidth;