积极答复者
TextBlock输入小数点或者符号的位置问题

问题
答案
-
你好,
据我所知,FlowDirection属性设置为RightToLeft会导致一些不希望出现的问题,譬如你提到的小数点位置和我负号位置问题,因此,如果你仅仅是想使得文字右对齐显示,建议使用TextAlignment属性,以下为我的Sample:
<Grid> <Label Content="TextAlignment: " Margin="-100,0,0,60" Width="100" Height="30" /> <TextBlock Background="AliceBlue" TextAlignment="Right" Margin="100,0,0,60" Width="100" Height="30" Text="{Binding Text,ElementName=tbox}" /> <Label Content="FlowDirection: " Margin="-100,60,0,0" Width="100" Height="30" /> <TextBlock Background="AliceBlue" FlowDirection="RightToLeft" Margin="100,60,0,0" Width="100" Height="30" Text="{Binding Text,ElementName=tbox}" /> <TextBox Name="tbox" Height="30" Width="100" VerticalAlignment="Bottom" /> </Grid>
如动图所示,可以看到TextAlignment属性设置后,TextBlock可以正确显示。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 JimmyGates 2014年5月21日 8:19
全部回复
-
你好,
据我所知,FlowDirection属性设置为RightToLeft会导致一些不希望出现的问题,譬如你提到的小数点位置和我负号位置问题,因此,如果你仅仅是想使得文字右对齐显示,建议使用TextAlignment属性,以下为我的Sample:
<Grid> <Label Content="TextAlignment: " Margin="-100,0,0,60" Width="100" Height="30" /> <TextBlock Background="AliceBlue" TextAlignment="Right" Margin="100,0,0,60" Width="100" Height="30" Text="{Binding Text,ElementName=tbox}" /> <Label Content="FlowDirection: " Margin="-100,60,0,0" Width="100" Height="30" /> <TextBlock Background="AliceBlue" FlowDirection="RightToLeft" Margin="100,60,0,0" Width="100" Height="30" Text="{Binding Text,ElementName=tbox}" /> <TextBox Name="tbox" Height="30" Width="100" VerticalAlignment="Bottom" /> </Grid>
如动图所示,可以看到TextAlignment属性设置后,TextBlock可以正确显示。
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- 已标记为答案 JimmyGates 2014年5月21日 8:19