Adapting silverlight content to web page width/height

2 posts, 0 answers
  1. Michele
    Michele avatar
    426 posts
    Member since:
    Jun 2009

    Posted 11 Aug 2009 Link to this post

    Hello to everybody,
    I'm facing difficulties adapting the silverlight control to the height/width of the page, if I don't set the height of the div I've got a wrong behavior on FFOX, I need to set something as :

       <div style="height: 780px;"
            <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/application.xap" MinimumVersion="2.0.31005.0" 
                Width="100%" Height="100%"

    How can I set the silverlight content to adapt to the screen resolution ? (for example one client can have a 640x480 res, I know it's 2009 but you never know)

    Thanks in advance


  2. Vlad
    Vlad avatar
    11100 posts

    Posted 11 Aug 2009 Link to this post

    Hello Paolo,

    If you want FF, Chrome and other similar browsers to behave correctly you need to set height in percentage for all parent elements including HTML tag:

    <style type="text/css">
    html, body, form {width:100%; height:100%; margin:0; padding:0;overflow:hidden;}

    <div style="height: 100%;">
            <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/application.xap" MinimumVersion="2.0.31005.0"
                Width="100%" Height="100%">

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top