Skip to main content

Microsoft Silverlight

Answered Question How to make resizable silverlight page within an asp page?RSS Feed

(0)

PregnantBySilverlight
Pregnant...

Member

Member

88 points

107 Posts

How to make resizable silverlight page within an asp page?

Hi Everybody,

I have a silverlight page within an asp page. It looks like I have to give a specific pixel when I place my silverlight into my asp page. I want to make it flexible and resizable, therefore, if the user resize the browser, the silverlight part gets resized by the browser!

Any thoughts are welcome :)

Thanks in advance....

the problem is in the line.....<div style="height:800px;width:1200px;">

Here is my code:

<body style="height:100%;margin:0;" bgcolor="#BBCBDD">

<form id="form1" runat="server" style="height:100%;">

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<table>

<tr><td>header

</td></tr>

<tr><td>

<div style="height:800px;width:1200px;">

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/MyProject.xap" MinimumVersion="2.0.30523" Width="100%" Height="100%" />

</div>

</td></tr>

<tr><td>footer

</td></tr>

</table>

 

 

</form>

</body>

sladapter
sladapter

All-Star

All-Star

17445 points

3,173 Posts

Re: How to make resizable silverlight page within an asp page?

 Use Percentage instead of fixed width/height in your Silverlight Container div:

<div style="height:800px;width:1200px;"> 

In your Silverlight control, make sure use Grid as LayoutRoot. Do not set the Width/Height in the Grid nor in the UserControl tag.

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

PregnantBySilverlight
Pregnant...

Member

Member

88 points

107 Posts

Re: Re: How to make resizable silverlight page within an asp page?

Thanks Sladapter,

Interesting, I was just going to email you directly before getting you reply to my answer Smile

I've done the suggestion you made, and it's still doesn't work....

Here is my code Silverlight page:

<UserControl

................

Width="Auto" Height="Auto"

.................. >

<Grid x:Name="LayoutRoot">

....................

<ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1" Grid.Column="1" x:Name="ContentPresenter"/>

</Grid>

and this is a master page which I load the ContentPresenter into it.....

So this masterpage with it's ContentPresenter is within my aspx page that I posted priviously.....

Thanks in advance
MT

sladapter
sladapter

All-Star

All-Star

17445 points

3,173 Posts

Re: Re: How to make resizable silverlight page within an asp page?

Make sure you set the height of the TD cell(use percentage too) that contains your Silverlight control in your aspx page. Your Silverlight code looks OK. If your Content is larger than the given area, put a ScrollViewer around it.

 

 

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

PregnantBySilverlight
Pregnant...

Member

Member

88 points

107 Posts

Re: Re: Re: How to make resizable silverlight page within an asp page?

Interesting...I managed my code by using Default.aspx instead of System7TestPage.aspx....

Here is my code in Default.aspx

<body>

<form id="form1" runat="server">

<asp:Table>

<asp:TableHeaderRow>

<asp:TableHeaderCell>Header</asp:TableHeaderCell>

</asp:TableHeaderRow>

<asp:TableRow>

<asp:TableCell>

<div>

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/System7.xap" MinimumVersion="2.0.30523" Width="100%" Height="100%" />

 

</div>

</asp:TableCell>

</asp:TableRow>

<asp:TableFooterRow>

<asp:TableCell>footer</asp:TableCell>

</asp:TableFooterRow>

</asp:Table>

 

 

</form>

</body>

 but it shows error for <asp:table> tag ???? not sure why???? it works fine....

however, I don't know how to make the default.aspx page as my default page....whenever I run the application....the System7TestPage.aspx is my default page!!!!!

I'm so confused, not knowing what's the difference between these three pages.... System7TestPage.html and System7TestPage.aspx and default.aspx

all these three pages are being generated at the time of creating my project called System7.
What's a usage of each of them?

I understand that I can make my frist page just an html page with Silverlight plug in....but then why do I have both default.aspx and System7TestPage.aspx.....

any answer would be welcome :)

Thank you so much for spending your time to answer my questions....
MT

sladapter
sladapter

All-Star

All-Star

17445 points

3,173 Posts

Answered Question

Re: Re: Re: How to make resizable silverlight page within an asp page?

 Right click Default.aspx select "Set As Start Page". You only need one page. You can delete System7TestPage.aspx.

sladapter
Software Engineer
Aprimo, Inc

Please remember to mark the replies as answers if they answered your question

PregnantBySilverlight
Pregnant...

Member

Member

88 points

107 Posts

Re: Re: Re: Re: How to make resizable silverlight page within an asp page?

Perfect...thanks a lot

now, I have another problem...this time is really strange...the errors that I'm getting....I completely delete whatever tag that I added and still I get the same errors....

here is the link to my question http://silverlight.net/forums/t/30728.aspx

thanks
MT

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities