Fork me on GitHub

Label

 

Label在下面的例子中不公当作标签,还提供了一个快捷方式一个字母。主要用Target="{Binding ElementName=tb}"来设置这个快捷方工,用Alt+下划线字母来实现跳转。很类似于焦点跳转。

XAML代码:

<Grid x:Name="LayoutRoot">

    <TextBox Name="tb" RenderTransformOrigin="0.5,0.5" Margin="143,8,245,0" VerticalAlignment="Top" Height="37" FontSize="22">

           <TextBox.RenderTransform>

                  <TransformGroup>

                         <ScaleTransform ScaleX="1" ScaleY="1"/>

                         <SkewTransform AngleX="0" AngleY="0"/>

                         <RotateTransform Angle="0"/>

                         <TranslateTransform X="0" Y="0"/>

                  </TransformGroup>

           </TextBox.RenderTransform>

    </TextBox>

    <Label Target="{Binding ElementName=tb}" HorizontalAlignment="Left" Margin="8,8,0,0" VerticalAlignment="Top" Width="135" Height="37" FontSize="22" FontWeight="Bold" Content="_First Name"/>

 

<TextBox Name="textBox1" Height="37" Margin="143,57,245,0" VerticalAlignment="Top" FontSize="22"/>

<Label Width="135" HorizontalAlignment="Left"

       Target="{Binding ElementName=textBox1}" Margin="8,57,0,0" VerticalAlignment="Top" Height="39" FontSize="22" FontWeight="Bold">

 <AccessText TextWrapping="WrapWithOverflow">

    _Last Name

 </AccessText>

</Label>

</Grid>

如下图:


 

 

本文参考MSDN组织。

posted @ 2007-03-29 11:19  桂素伟  阅读(396)  评论(2编辑  收藏  举报