我正在开发简单的聊天WP应用程序。我使用Coding4Fun工具包中的ChatBubble文本块控件。当用户用手指按住并向上/向下移动时,我想让这个控制滚动。我通过将ContentControl放在ScrollViewer控件中来改变控件样式,但没有帮助。它只是负责任"现在但我还是不能在里面滚动。
<Border x:Name="EnabledBorder"
Grid.Row="1"
Padding="{TemplateBinding Padding}"
BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}">
<Grid>
<ContentControl
x:Name="HintContentElement"
BorderThickness="0"
Background="Transparent"
Foreground="Gray"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Hint}" />
<ScrollViewer>
<ContentControl
x:Name="ContentElement"
Margin="1 2"
MaxHeight="170"
BorderThickness="0"
Background="Transparent"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</ScrollViewer>
</Grid>
</Border>
这是XAML页面
<c4f:ChatBubbleTextBox
InputScope="Text"
TextChanged="ChatBubbleTextBox_TextChanged"
Text="{Binding CommentText, Mode=TwoWay}"
ChatBubbleDirection="LowerRight"
TextWrapping="Wrap"
AcceptsReturn="True"
Style="{StaticResource themeAwareChatBubbleStyle}" />
答案 0 :(得分:0)
修复该问题: 取代
<ScrollViewer>
<ContentControl
x:Name="ContentElement"
Margin="1 2"
MaxHeight="170"
BorderThickness="0"
Background="Transparent"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</ScrollViewer>
与
<ScrollViewer
x:Name="ContentElement"
Margin="1 2"
MaxHeight="170"
BorderThickness="0"
Background="Transparent"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />