如何從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