0

I want to show a big text next to an image, in a resizable window.

I found here that it's pssible to use a WrapPanel, but this control need a fixed width and the width of my window is not fixe.

I tried the following code, but sometimes, the text is placed under the image (depanding on the window size) :

<Border Grid.Row="0" BorderBrush="Black" BorderThickness="1" CornerRadius="1" Background="PaleGoldenrod" Grid.Column="0" Margin="5">
    <StackPanel Orientation="Vertical" Opacity="0.8" >
        <WrapPanel Orientation="Horizontal" Width="{Binding ElementName=RadGridViewFoldersSettingsRSP, Path=Width}">
            <Image Source="/Pics/Resources/btn_about_active.png" Margin="2" Width="20"/>
            <TextBlock Text="blablabla" TextWrapping="WrapWithOverflow" Margin="2" FontStyle="Italic"/>
         </WrapPanel>
     </StackPanel>
 </Border>

This border is above a grid as wide as the window.

Can you help me ?

  • 4
    Why are you using a WrapPanel at all? If you always want the TextBlock next to the Image, you should use a StackPanel. – mm8 Dec 19 '17 at 15:28
  • The StackPanel is no wrapping, and when the text as wide as the window, a part of this text is hidden. –  Dec 19 '17 at 15:33
  • I want to wrap a text depanding of the window size. I found the solution when I searched to answer to you. I'm going to publish here right now ! –  Dec 19 '17 at 15:45

1 Answers1

0

To resolve my issue, i'm going to another way :

<Border Grid.Row="0" BorderBrush="Black" BorderThickness="1" CornerRadius="1" Background="PaleGoldenrod" Grid.Column="0" Margin="5">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Image Source="/Pics/Resources/btn_about_active.png" Margin="2" Width="20" Grid.Column="0"/>
        <TextBlock Grid.Column="1" Text="BIG TEXT" TextWrapping="WrapWithOverflow" Margin="2" FontStyle="Italic"/>
    </Grid>
</Border>

Thanks to mm8 for his reactivity !