How to remove the Left and Top margins in a Silverlight Form RRS feed

  • Question

  • There is a white space in my silverlight app on the left side and Top of my form about 1/4 of an inch. I would like to remove this white space so the form takes up the entire window which is opened.

    Here is my javascript:

    <script language="javascript" type="text/javascript">
    function PopupCenter(pageURL, title,w,h) {
    var left = (screen.width/2)-(600/2);
    var top = (screen.height/2)-(635/2);
    var targetWin = window.open ('http://WebsiteName/WebForm1.aspx#/MainPage', 'SendPage', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+600+', height='+650+', top='+top+', left='+left);
    		   	<asp:Button runat="server" Text="Button" id="Button1" OnClientClick="PopupCenter()"/> 
    Here is my code in my MainPage.xaml:
        <Grid x:Name="LayoutRoot" Background="#FF3F6896" Height="634" Width="600" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    Here is the code in the webform1.asp:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Pager.Web.WebForm1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
       <form id="form1" runat="server" style="height:100%">
        <div id="silverlightControlHost">
            <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="600px" height="650px" style="margin-left: auto; margin-right: auto; clip: rect(0px, auto, auto, 0px); top: 0px; left: 0px;" align="middle">
    		  <param name="source" value="ClientBin/Pager.xap"/>
    		  <param name="onError" value="onSilverlightError" />
    		  <param name="background" value="white" />
    		  <param name="minRuntimeVersion" value="4.0.60310.0" />
    		  <param name="autoUpgrade" value="true" />
              <param name="initParams" value="ClientIPAddress=<%=ClientIPAddress%>, ClientComputerName=<%=ClientName%>, CurrentLogonUser=<%=LogonUser%>"/>
    		  <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.60310.0" style="text-decoration:none">
     			  <img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style:none"/>
    	    </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    Monday, October 24, 2011 1:23 PM

All replies

  • Try to remove Width/Height setting on the LayoutRoot Grid.

    Monday, October 24, 2011 1:44 PM
  • Thank you - I tried that in the WebForm1.aspx page, and no luck.

    Monday, October 24, 2011 3:55 PM
  • What I meant is this:
     <Grid x:Name="LayoutRoot" Background="#FF3F6896" Height="634" Width="600" Margin="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    Monday, October 24, 2011 4:01 PM
  • I misspoke - I meant to say MainPage.xaml. So, yes, I made that change, and still have a white border just on the left side and top.

    Monday, October 24, 2011 4:09 PM
  • Hi Vss712,

    To troubleshoot the issue, we need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. You can remove any confidential information or business logic from it. You can upload the repro project in the skydrive and post the link here.

    In addtion, below is a sample which implements building a simple Forms application using the Silverlight Tools for Visual Studio 2010 and WCF RIA Services, you may have a look:


    Best Regards,

    Wednesday, October 26, 2011 2:16 AM
  • Thank you, Haixia.

    I will post the code on Skydrive tonight. Should I send the invitation to: msdnmg@microsoft.com


    Thank you,

    Monday, November 28, 2011 4:45 PM