如何从SILVERLIGHT Grid
XAML中的跳位序列中排除TextBlock
。我知道TextBox
,我们使用IsTabStop
虚假或TabIndex
-1,但相同的属性是不缴费的TextBlock
停止Tab键序列中的文本块(不是文本框)
我有4所控制,1和4 TextBox
(编辑)和2和3是TextBlock
(不可编辑)。当我标签时,所有4个都包含在标签序列中。
我想从tab中排除2,3(Textblocks)。意思是,如果我从TextBox
1选项卡,焦点应直接移动到TextBox
4.请帮助。
加载= “UserControl_Loaded”>
<DataTemplate x:Key="CellEditClientAllocations" >
<TextBox Text="{Binding ClientAllocations, Mode=TwoWay}"
Style="{StaticResource GridCellTextBoxStyle}"
x:Name="tbxClientAllocations"
Loaded="TextBox_Loaded"
TextChanged="tbxClientAllocations_TextChanged"
KeyDown="tbxClientAllocations_KeyDown"
LostFocus="tbxClientAllocations_LostFocus"
GotFocus="tbxClientAllocations_GotFocus"/>
</DataTemplate>
<DataTemplate x:Key="CellAccountId">
<TextBlock Text="{Binding AccountId, Converter={StaticResource anc}}" Style="{StaticResource GridCellTextBlockStyle}" /> </DataTemplate>
<DataTemplate x:Key="CellEditAccountId">
<TextBox Text="{Binding AccountId, Converter={StaticResource anc}, Mode=TwoWay}" x:Name="tbxAccountId" LostFocus="TbxAccountIdLostFocus" TextChanged="TbxAccountIdTextChanged" GotFocus="tbxAccountId_GotFocus"/>
</DataTemplate><DataTemplate x:Key="CellAccountName"> <StackPanel>
<TextBlock VerticalAlignment="Center" Text="{Binding AccountName, Mode=TwoWay}" Foreground="{Binding IsAccountValid, Converter={StaticResource cc}}" kStyle="{StaticResource GridCellTextBlockStyle}" Name="Account" MouseRightButtonUp="" > </TextBlock> </StackPanel> </DataTemplate>
<DataTemplate x:Key="CellLotInstructions"> <StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding LotInstructions}" Style="{StaticResource GridCellTextBlockStyle}"/>
<HyperlinkButton Content="Edit" Style="{StaticResource HyperlinkButtonStyleUnderline}" IsEnabled="{Binding LotInstructionsEnabled}" Name="Lotinstructons" HorizontalContentAlignment="Center" MouseLeftButtonDown="LotinstructonsMouseLeftButtonDown" VerticalContentAlignment="Center" Click="ViewSpecifyLots_Click" Visibility="{Binding LotInstructionsEdit}" /> </StackPanel> </DataTemplate>
怎么可能texblock有焦点..这是不可能的。这就是为什么没有这种可聚焦的财产。一定有东西在后面..如果我错了,请原谅我 –
分享你的XAML,'TextBlock'默认不会获得焦点,所以在这里必须有别的东西在玩。你可能实际上是指“DataGrid”字段而不是单独的TextBlock的/ TextBox的? –
感谢您的帮助。 @Chris,文本框和文本块位于DataGrid中,而不是单独的文本框/块。附加XAML。在开始的时候,我们添加了 –
user2235485