This is a migrated thread and some comments may be shown as answers.

Little Silverligfht help needed for margin

2 Answers 23 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
CSurieux
Top achievements
Rank 2
CSurieux asked on 07 Dec 2009, 04:29 PM
Hello,

New to silverlight, building a RadBook content I have the following code
            <Grid> 
                <Image Source="Images/encart_fond_page.png" Width="399" Height="446" /> 
                <Image Source="Images/encart_sur_fond.png" Width="390" Height="436" Margin="4,5,5,5" /> 
                <Image Source="Images/encart_titre.png" Height="31" Margin="10,15,8,0" VerticalAlignment="Top" /> 
                <StackPanel Margin="30,25,0,0">  
                    <TextBlock Text="SERVICES COMPLEMENTAIRES ET PARAMETRAGE"  HorizontalAlignment="Left"   
                               FontFamily="Arial" Foreground="White" FontSize="11" /> 
                </StackPanel> 
                <Grid Margin="10,52,8,0" > 
<Grid.ColumnDefinitions> 
                        <ColumnDefinition Width="*" /> 
                    </Grid.ColumnDefinitions> 
                    <Grid.RowDefinitions> 
                        <RowDefinition Height="Auto"/>  
                        <RowDefinition Height="Auto" /> 
                        <RowDefinition Height="Auto" /> 
                    </Grid.RowDefinitions> 
                    <Rectangle Margin="0,0,0,0" Grid.Row="0" Grid.Column="0" Fill="White" RadiusX="5" RadiusY="5" /> 

And I dont undestand why the image encart_titre.pgn has not same horizontal margins a the sub grid rectangle ?
Is there something special when nesting grids ?
I just set the same Margin to image and grid, but the grid is larger and has smaller margin than the image ?

This is certainly an elementary item for a skilled user but I have been anable to find solution on general forums.

Thanks you for help.

CS

2 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 09 Dec 2009, 02:03 PM
Hello Christian Surieux,

Most probably your Image is smaller then the Grid. Stretch property of Image control have default value of Uniform. This will limit the horizontal stretching based on available height. Image.HorizontalAlignment default value is Stretch which will center the Image if its size is smaller then the available size. You can read more about HorizontalAlignment from here:
http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.horizontalalignment(VS.95).aspx

Sincerely yours,

Hristo
the Telerik team

 


Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
CSurieux
Top achievements
Rank 2
answered on 09 Dec 2009, 02:11 PM
Thank you for explaining
Best regards
CS
Tags
General Discussions
Asked by
CSurieux
Top achievements
Rank 2
Answers by
Hristo
Telerik team
CSurieux
Top achievements
Rank 2
Share this question
or