Little Silverligfht help needed for margin

3 posts, 0 answers
  1. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 07 Dec 2009 Link to this post

    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. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 09 Dec 2009 Link to this post

    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.
  3. DevCraft banner
  4. CSurieux
    CSurieux avatar
    465 posts
    Member since:
    Jan 2007

    Posted 09 Dec 2009 Link to this post

    Thank you for explaining
    Best regards
    CS
Back to Top