Xaml 如何将lengthindicator更改为显示在phonetextbox的右上角位置,是否有要设置的垂直对齐属性?
我尝试了以下样式(从),但垂直对齐不起作用:Xaml 如何将lengthindicator更改为显示在phonetextbox的右上角位置,是否有要设置的垂直对齐属性?,xaml,windows-phone,Xaml,Windows Phone,我尝试了以下样式(从),但垂直对齐不起作用: <phone:PhoneApplicationPage.Resources> <Style x:Key="PhoneTextBoxStyle" TargetType="toolkit:PhoneTextBox"> <Setter Property="Template"> <Setter.Value> <ControlTem
<phone:PhoneApplicationPage.Resources>
<Style x:Key="PhoneTextBoxStyle" TargetType="toolkit:PhoneTextBox">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="toolkit:PhoneTextBox">
<Grid x:Name="RootGrid" Background="Transparent">
<Border x:Name="LengthIndicatorBorder">
<TextBlock x:Name="LengthIndicator" HorizontalAlignment="Right" Margin="0" Opacity="0" TextAlignment="Right" VerticalAlignment="Top">
<TextBlock.RenderTransform>
<TranslateTransform/>
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</phone:PhoneApplicationPage.Resources>
我使用的控件如下所示:
<toolkit:PhoneTextBox LengthIndicatorVisible="True" DisplayedMaxLength="10" />
要更改长度指示器的位置,只需更改参数ib和LengthindIndicator Visible的可视状态(尤其是平移变换和边距的更改): 下面是使指示器显示在顶部的完整样式(只是默认的PhoneTextBox样式,在这里我删除了前面提到的代码,检索默认样式的方法是在visual studio中进入大纲窗口,在PhoneTextBox上单击鼠标右键,->模板->编辑副本):
崩溃
看得见的
伸展
看得见的
崩溃
只需在控件上设置样式:
<toolkit:PhoneTextBox LengthIndicatorVisible="True" DisplayedMaxLength="10" Style="{StaticResource PhoneTextBoxStyleIndicatorOnTop}"/>
我的代码中没有使用这些样式,这是我仅有的样式代码appli
<toolkit:PhoneTextBox LengthIndicatorVisible="True" DisplayedMaxLength="10" Style="{StaticResource PhoneTextBoxStyleIndicatorOnTop}"/>