我正在寻找一个类似于默认短信应用中的“气泡”文本框的控件。我能够靠近,创建一个“泡沫”形状的路径,里面有一个文本框,但是文本框大小有问题。我已将文本框中的“AcceptsReturn”设置为True。我注意到的是,当文本框中的行数增加时,文本框会从视图中消失(在SIP下)。这不是SMS文本框的行为方式 - 它似乎总是向上滚动以显示最新行(而我的控件变为隐藏)。非常感谢任何指针...
[更新] 通过自定义TextBox模板来管理以创建它:
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Rectangle Grid.Row="1" StrokeThickness="0" Fill="{TemplateBinding Background}"/>
<ContentControl Grid.Row="1" x:Name="ContentElement" HorizontalContentAlignment="Stretch" Margin="0" Padding="{StaticResource PhoneTouchTargetLargeOverhang}" VerticalContentAlignment="Stretch" FontSize="{StaticResource PhoneFontSizeNormal}" Background="Black" />
<Path Data="M161.25,90.75 L184.25,90.75 L184.25,100.75" HorizontalAlignment="Left" Grid.Row="0" Stretch="Fill" StrokeThickness="0" UseLayoutRounding="False" Width="23" RenderTransformOrigin="0.5,0.5" Fill="{TemplateBinding Background}" Margin="54.75,0,0,0">
<Path.RenderTransform>
<CompositeTransform Rotation="180"/>
</Path.RenderTransform>
</Path>
<Rectangle Grid.Row="2" Fill="{TemplateBinding Background}"/>
<TextBlock x:Name="txtTimeStamp" Grid.Row="2" TextWrapping="Wrap" Padding="{TemplateBinding Padding}" FontSize="{StaticResource PhoneFontSizeSmall}" Text="{Binding Timestamp, Converter={StaticResource dateTimeConverter}, Mode=TwoWay}">
<TextBlock.Foreground>
<SolidColorBrush Color="{StaticResource PhoneTextBoxForegroundColor}"/>
</TextBlock.Foreground>
</TextBlock>
</Grid>