Skip to main content

Microsoft Silverlight

Help please, URGENT, about layout panel sizesRSS Feed

(0)

PrisonBreak
PrisonBreak

Member

Member

31 points

61 Posts

Help please, URGENT, about layout panel sizes

Hi silverlight masters,

My problem is urgent I need to complete my part in the silverlight project as soon as possible so looking for your help.

Please check out the picture I attached to my message, as you see one half of the circle at the bottom can not be seen. In my page.xaml my code is :

1   <UserControl x:Name="UserControlMain" x:Class="SilverlightHedefGosterge.Page"
2        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
3        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
4        Width="200" Height="auto">
5    
6        <StackPanel x:Name="myStackPanel" Height="auto" Width="200" Background="Black" Orientation="Vertical" ScrollViewer.VerticalScrollBarVisibility="Visible">
7    
8           
9        </StackPanel>
10   </UserControl>

 

In my page.xaml.vb file the code is:

1    Partial Public Class Page
2        Inherits UserControl
3        Public Sub New()
4            InitializeComponent()
5            Dim counter As Integer
6            For counter = 0 To 25
7                Dim HedefKartXAML = <Ellipse xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Height="150" Margin="20,22,0,0" Width="150"
8                                        <Ellipse.Fill>
9                                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
10                                               <GradientStop Color="#FF000000"/>
11                                               <GradientStop Color="#FFFFFFFF" Offset="1"/>
12                                           </LinearGradientBrush>
13                                       </Ellipse.Fill>
14                                   </Ellipse>
15               Dim HedefKart = System.Windows.Markup.XamlReader.Load(HedefKartXAML.ToString)
16               Me.myStackPanel.Children.Add(HedefKart)
17           Next counter
18       End Sub
19   End Class
 
As you can see I am generating my controls and placing them in the stack panel at run time. As you can see I want 25 circles to be drawn on the screen but only 4 and a half of them 
is drawn. I just simplified my actual code and replaced my own control by circles. So my questions:
Is stack panel control (or canvas, grid) have a max height fixed? How can I solve my problem? Do you have any other suggestions to do what I am trying to?
By the way this usercontrol will be used in an aspx page, so is there a better way to create my controls in the aspx page instead of page.xaml.vb?
 
PLEASE HELP!

 

hiteshbhagwat
hiteshbh...

Participant

Participant

1237 points

283 Posts

Re: Help please, URGENT, about layout panel sizes

Hi,

I can not able to see yor image but the max width & height for content control is infinity so you can add any no of control .AS I can,t see u r image but can guess your problem I think increase size of u r usercontrol as well as silverlight plugin size.Plugin size u can increase in aspx page where u r rendering u r silverlight plugin.

Thanks & Regards
Hitesh

If this answer your que plz mark as answer

PrisonBreak
PrisonBreak

Member

Member

31 points

61 Posts

Re: Help please, URGENT, about layout panel sizes

Hi, thanks for your answer, I realized that the aspx page which my silverlight control is hosted has the table (it contains silverlight control) which its height is fixed to 800px, now I set a bigger value for that so it is now big enough to hold the circles that I mentioned (for example 5000px), and also  I set the height and width properties of the stackpanel and user control to auto. But now the problem is I dont have any information that how many of the controls will be dynamically generated since it will be feeded from a database, so it is not a good approach to set the table's height property to a fixed size (for example 5000 px). But also there is not the "auto"  option to set for the silverlight control area in the aspx page. You can only set a value of px or inches. So how can I deal with this problem? My code in the aspx file is below:

Looking forward for your help, regards...

 

1    <table style="width: auto; height: auto">
2            <tr>
3                <td style="height: auto width: auto">
4                </td>
5                <td style="width: auto; height: auto">
6                <asp:ScriptManager ID="ScriptManager1" runat="server" />
7                <asp:Silverlight ID="HedefKart" runat="server" Source="~/ClientBin/SilverlightHedefGosterge.xap"
8                                 MinimumVersion="2.0.30523" Height="5000px" Width="640px" />
9                </td>
10           </tr>
11   </table>    
 

jeetAbhi
jeetAbhi

Member

Member

424 points

81 Posts

Re: Help please, URGENT, about layout panel sizes

Well half of the things in ur post are not visible....If u are addding xaml control as string then that is not how u do it...i dont know much about vb....have a look at this article.....

In C# i would do it this way ....

string xamlString = "<Ellipse xmlns=\"http://schemas.microsoft.com/client/2007\" "

+ "Height=\"30\" "

+ "Width=\"40 "\" "

+"<Ellipse.Fill>"

+"<LinearGradientBrush EndPoint=\"0.5,1 \" StartPoint=\"0.5,0 \">"

and so on so forth......then....

Ellipse ep = XamlReader.Load(xamlEllipse) as Ellipse;

myStackPanel.Children.Add(ep);

Kindly MARK AS ANSWER if this helps.....


               

Also keep ur stackpanel

jeetAbhi
jeetAbhi

Member

Member

424 points

81 Posts

Re: Re: Help please, URGENT, about layout panel sizes

Just put Height="100%" It would give you same effect Giving it 5000px would give you unnecessary scroll.....

Kindly MARK AS ANSWER if this helps.

PrisonBreak
PrisonBreak

Member

Member

31 points

61 Posts

Re: Re: Help please, URGENT, about layout panel sizes

thanks jeetAbhi but when I set the height property to 100% nothing is visible on the screen... completely blank page...

 and also when I try to set the height value to auto a popup wimdow is opened saying:

"'auto' cannot be parsed as a unit as there are no numeric values in it. Examples of valid unit strings are '1px' and '.5in'."

 

Yi-Lun Luo - MSFT
Yi-Lun L...

All-Star

All-Star

25052 points

2,747 Posts

Re: Help please, URGENT, about layout panel sizes

Hello, I think what you need is a Silverlight ScrollViewer. Try something like this:

<ScrollViewer>
<StackPanel Width="500" Height="Auto" x:Name="LayoutRoot" Background="Red">
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
<Ellipse Fill="Blue" Height="500"/>
</StackPanel>
</ScrollViewer>

 

That is, no matter how large the content is, it'll always be scrolled.

shanaolanxing - I'll transfer to the Windows Azure team, and will have limited time to participate in the Silverlight forum. Apologize if I don't answer your questions in time.

PrisonBreak
PrisonBreak

Member

Member

31 points

61 Posts

Re: Help please, URGENT, about layout panel sizes

Hi, Yi-Lun Luo. The scrollview can not solve my problem. I should set the height and width values of the silverlight control on the aspx page anyway.Like below:

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

<asp:Silverlight ID="HedefKart" runat="server" Source="~/ClientBin/SilverlightHedefGosterge.xap"

MinimumVersion="2.0.30523" Height="5000px" Width="640px" />

 When I try to left them blank a blank page is generated, when I try to set the value to "100%" again a blank page. When I set "auto" or "*" whatever an error is generated.

PLEASE SOMEBODY HELP ME. Is that a bug or something how a value of "auto" can not be set to a silverlight control on aspx page?

stone_wei
stone_wei

Member

Member

6 points

3 Posts

Re: Re: Help please, URGENT, about layout panel sizes

Hi PrisonBreak.

In an empty silverlight project there three Height properties.

The first in aspx file used in  <asp:silverlight/> element to set the Height of the contorl. If it is '100%', the control will fill the explorer. If the value is smaller than your contorl you will see the cutted pic.

The second is the Height of the custom contorl. If 100% it will fill the <asp:silverlight>. And the third is in the container.

So if you want to get stackpanel larger than the screen's height should set the first Height in <asp:silverlight> in the hosted aspx file.

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities