I have an WPF usercontrol which has a grid with 4 columns and only 1 row.
The second column is a WPF label.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
// I only specify there the label, no other components, just to simplify
<Label Grid.Column="1"
VerticalAlignment="Center"
Margin="5"
Content="{Binding Path=Text}"
Foreground="{Binding Path=ForegroundColor}">
<Label.Resources>
<Style TargetType="TextBlock">
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
</Label.Resources>
</Label>
</Grid>
For some reason the text of the label is being cut-off at the end of the line instead of putting it at next line. I have tried above solution to wrap text and continue in the next line but it is not working. Any ideas?
UPDATE: I changed the Label as below according to this:
<Label Grid.Column="1"
VerticalAlignment="Center"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Stretch"
HorizontalAlignment="Stretch"
Height="Auto"
Margin="5"
Foreground="{Binding Path=ForegroundColor}">
<TextBlock Text="{Binding Path=Text}" TextWrapping="Wrap"/>
</Label>
and now it is working like a charm!