I'm trying to make a really simple title panel, which contains an Image
-icon and TextBlock
-title in the center of the panel:
To achieve this with
TextBlock
, I could use StackPanel
with Vertical
-orientation. But this doesn't work when I need to add the Image
in front of TextBlock
.
This is the current code, which doesn't work with the TextTrimming
:
<StackPanel Orientation="Horizontal">
<Image
Height="28"
Width="28"
Margin="0,0,10,0"
Source="/Resources/Images/Icons/MyIcon.png"
HorizontalAlignment="Left"
VerticalAlignment="Center"/>
<TextBlock x:Name="TitleText"
Text="Test text test text Test asd asd "
VerticalAlignment="Center"
FontSize="28"
TextWrapping="NoWrap"
TextTrimming="WordEllipsis"/>
</StackPanel>
Another solution could be to control the Width
of the TextBlock
in code, but I'd like to achieve this within XAML
. Any ideas?