我有這樣的事情:
<ControlTemplate>
<StackPanel Orientation="Horizontal">
<!--Icon-->
<Ellipse Width="30" Height="30" Margin="10,0,0,-5">
<Ellipse.Fill>
<ImageBrush ImageSource="{Binding ImageSource}"
RenderOptions.BitmapScalingMode="Fant"/>
</Ellipse.Fill>
</Ellipse>
<!--Surround Info-->
<StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding Name}"
Foreground="{Binding UserNameColor}"
FontWeight="SemiBold"
VerticalAlignment="Center"
Margin="0,0,-5,0"/>
<Label Content="{Binding Date}"
Foreground="White"
FontWeight="SemiBold"
FontSize="8"
VerticalAlignment="Center"
Margin="0,0,-5,0"/>
</StackPanel>
<!--Message-->
<Border VerticalAlignment="Center" CornerRadius="10 15 15 0" Margin="2 2 88 3" Background="LightSlateGray">
<TextBlock Foreground="White" Margin="7" TextWrapping="Wrap" FontWeight="SemiBold" Text="{Binding Content}"/>
</Border>
</StackPanel>
</StackPanel>
</ControlTemplate>
我需要 textblock 用里面的文本換行,但我不知道如何在不提供我不想要的邊框寬度的情況下這樣做
我想實作這樣的目標:

uj5u.com熱心網友回復:
您似乎在 StackPanels 內部使用 StackPanels。有一個已知問題,即 StackPanel 將接收其父級的調整大小事件,但僅當大小增加時。參考:
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/341575.html
