Gun
Gun

Reputation: 521

Specific layout for Windows Phone 7

I would like to create this layout in Silverlight. The text need to wrap around the picture : enter image description here

The closest solution i find is that but this is not exactly what i would like.

<StackPanel Margin="0,0,0,20">
    <TextBlock Text="{Binding Title}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
    <StackPanel Orientation="Horizontal" >
        <Image Source="{Binding Img}" MaxWidth="100" />
        <TextBlock Text="{Binding Desc}" TextWrapping="Wrap" Margin="0,10,0,5" Style="{StaticResource PhoneTextSubtleStyle}"/>
    </StackPanel>
</StackPanel>

Upvotes: 0

Views: 226

Answers (1)

gbanfill
gbanfill

Reputation: 2216

Best I can come up with is to use a grid

<Grid >
    <Grid.RowDefinitions>
       <RowDefinition Height="40" />
       <RowDefinition Height="40" />
       <RowDefinition Height="40" />
    </Grid.RowDefinitions>

    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="200" />
        <ColumnDefinition Width="200" />
    </Grid.ColumnDefinitions>

    <TextBlock Text="Title" Grid.Row="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" />

    <TextBlock Text="Image" Grid.Row="1" Grid.Column="0" />
    <TextBlock Text="Description" TextWrapping="Wrap" Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" />
</Grid>

Another Suggestion would be to use the RichTextBox. I got not too bad results using

<RichTextBox  Width="400" Height="400" FontSize="40">
    <Paragraph>
        <InlineUIContainer >
           <Image Source="/image.png" Width="100" Height="200" />
         </InlineUIContainer>
        <Run Text="A simple RichTextBox with Image: " />
        <Italic Foreground="YellowGreen">Some Italic Text Here!</Italic>
     </Paragraph>
</RichTextBox>

Upvotes: 3

Related Questions