【发布时间】:2021-12-14 18:13:11
【问题描述】:
我有这样的事情:
<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>
我需要文本块用里面的文本换行,但我不知道如何在不提供我不想要的边框宽度的情况下这样做
我想实现这样的目标:
【问题讨论】:
-
不清楚你想要实现什么。试着解释你的问题,让每个人都能理解。同时展示您已经尝试过的内容。
-
听起来你想要一个设置了圆角半径的边框,然后在里面放一个带边距的文本块,并且不知道为什么要使用 controltemplate (sus)
-
我是 wpf 的新手,我需要将边框内的文本块进行换行,但它不是,我认为是因为边框,我不知道如何解决这个问题跨度>