c# - WP7 - 文本框光标位置错误

标签 c# xaml windows-phone-7

我有一个文本框(我已经通过编辑模板对其进行了更改)。我在content元素的border上加了一个Scrollviewer,这样我就有了水平滚动的能力,就像IE中的地址栏文本框一样。

现在我已经添加了 ScrollViewer,当我选择文本框内的文本时,光标的位置不正确。下面是说明这一点的更好方法:

enter image description here

我的 XAML 是:

<ScrollViewer Margin="{StaticResource PhoneTouchTargetOverhang}" Width="Auto" BorderThickness="3" HorizontalScrollBarVisibility="Hidden">
   <Border BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="Transparent" Height="48" Width="Auto">
    <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch" Style="{StaticResource ContentControlStyle1}"/>
  </Border>
</ScrollViewer>

基本上就是这样!我添加的只是 ScrollViewer 并且发生了错误。我该怎么做才能解决这个问题?

谢谢!

最佳答案

尝试给 ScrollViewer 一个固定的高度

关于c# - WP7 - 文本框光标位置错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21090665/

相关文章:

windows-phone-7 - 在 Windows Phone 7 上部署应用程序

silverlight - 在 Windows Phone 7 中发起调用

c# - MySQL日期格式问题

c# - Silverlight:在 XAML 中声明数据集合?

xaml - 如何只为特定平台设置 OnPlatform?

c# - c#中图像的边框

c# - 取 n 个元素。结束的从头开始

c# - 在 XAML 页面之间传递值

c# - C#计时器在循环期间抛出错误?

c# - WindowChrome - 无法单击标题栏中的按钮