我有一個文本框(我通過編輯模板進行了更改)。我爲內容元素的border
添加了一個Scrollviewer
,以便我具有水平滾動功能,就像IE中的地址欄文本框一樣。WP7 - 文本框光標位置錯誤
現在我已經添加了ScrollViewer
,當我選擇文本框內的文本時,光標位置不正確。一個更好的方式來說明這是下面:
我的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
併發生錯誤。我能做些什麼來解決這個問題?
謝謝!
當你選擇文本時,你會發生什麼?你想要光標在哪裏?是否有實際的錯誤發生或者行爲與您的期望不符?你需要更具體一點。 – lhan
只有選擇光標位置不正確纔會發生真正的錯誤。基本上我需要它,以便選擇文本框內,就像任何其他文本框,當你鍵入文本。例如:http://puu.sh/6jH1y.png –
嗯。仍然不確定我明白。你是在談論當你**在文本框中的文本上點擊**時,它突出顯示不正確? – lhan