Skip to main content
Home Forums Silverlight Programming Programming with .NET - General Silverlight Form Resize.
5 replies. Latest Post by see_sana_here on November 5, 2009.
(0)
klmelaya
Member
2 points
10 Posts
03-25-2009 9:22 AM |
Hi,
I have changed my system resolution, In case of silverlight form is not resized.
by
Elayaraja
Tim Dawson
Participant
1140 points
218 Posts
03-25-2009 9:31 AM |
Silverlight content is displayed in a browser; what does your system resolution have to do with it? I would not expect anything to change in your Silverlight application when the system resolution is changed.
03-25-2009 9:48 AM |
hi,
my system resolution is 1600. The design is developed in 1024 pixels.
The resize problem is occured when after publishing...
i think change silverlight html or aspx.
plz help..
thanks
Mog Lian...
All-Star
16023 points
1,553 Posts
03-31-2009 12:43 AM |
In silverlight, if you don't set UserControl's width/height property, the silverlight control will fill the place which you offered in html pages, and Grid as well, it will fill the parent's space automaticly. XAML like this:
<UserControl x:Class="SL3_test1.SilverlightControl2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid x:Name="LayoutRoot" Background="White"> ...... </Grid> </UserControl>
If the UserControl be set with fix size, it also can be resized in aspx page by setting asp.net control "Silverlight" 's ScaleMode=Stretch or Zoom
<asp:Silverlight ID="Silverlight1" runat="server" Source="~/ClientBin/SL3_test1.xap" MinimumVersion="3.0.40307.0" ScaleMode=Zoom Width="100%" Height="100%" />
btcrawler
2 Posts
04-14-2009 7:41 PM |
I'm having problems with the resizing, i'm using the Visifire chart tool, i'm sending the chart from the .cs file with something like this: LayoutRoot.Children.Add(chart)
Here is my code:
<UserControl x:Class="ResizeTest_1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid x:Name="LayoutRoot" Background="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"> </Grid></UserControl>
<html xmlns="http://www.w3.org/1999/xhtml" style="height:100%;"><head runat="server"> <title>ResizeTest_1</title></head><body style="height:100%;"> <form id="form1" runat="server" style="height:100%;"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div style="height:100%;"> <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/ResizeTest_1.xap" Version="2.0" Enabled="true" EnableHtmlAccess="true" Visible="true" Width="100%" Height="100%"> </asp:Silverlight> </div> </form></body></html>
I need to add the style="height:100%;" property to each tag, otherwise the chart doesn't resize correctly. I also tried with the ScaleMode="Stretch" inside the div tag but i got a blank page when using this property.
see_sana...
1 Posts
11-05-2009 1:02 AM |
Hi btcrawler...
Add a scrollviewer for the grid and set the properties HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
<UserControl x:Class="ResizeTest_1.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> <Grid x:Name="LayoutRoot" Background="White" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" >
<Grid.RowDefinitions > <RowDefinition ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></RowDefinition> <RowDefinition ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions > <ColumnDefinition ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></ColumnDefinition> <ColumnDefinition ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></ColumnDefinition> <ColumnDefinition ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"></ColumnDefinition> </Grid.ColumnDefinitions> </Grid></ScrollViewer></UserControl>
Place the contols in grid.