gpt4 book ai didi

TreeViewItem 元素中的 C# 选项卡索引

转载 作者:太空宇宙 更新时间:2023-11-03 15:38:57 25 4
gpt4 key购买 nike

我有一个简单的 TreeView,我无法使用焦点在 TextBox 中导航。你有什么建议吗???

我已经更新了 xaml 代码,以便为您提供更多详细信息。我希望这是有帮助的。更多详情。更多详情。更多详情。更多详情。更多细节。

<StackPanel Orientation="Vertical" Margin="5">
<StackPanel Orientation="Vertical">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="Column1"/>
<ColumnDefinition Width="5" SharedSizeGroup="Column2"/>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>

<GridSplitter Grid.Column="1" Grid.RowSpan="2147483647" HorizontalAlignment="Left" Width="5" VerticalContentAlignment="Stretch" IsTabStop="False"/>

<TextBlock Name="Number" Grid.Row="0" Grid.Column="0" Text="Number"/>
<TextBox x:Name="TxtNumber" Grid.Row="0" Grid.Column="2" Text="{Binding Number}" TabIndex="0"/>

<TextBlock Name="Name" Grid.Row="1" Grid.Column="0" Text="Name"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding Name}" TabIndex="1"/>
</Grid>
</StackPanel>

<StackPanel Orientation="Vertical">
<TextBlock Text="MyTree"/>

<TreeView x:Name="MyTree" BorderThickness="0" Grid.IsSharedSizeScope="True" KeyboardNavigation.TabNavigation="Continue">
<TreeView.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="Black" />
</TreeView.Resources>

<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True" />
<Setter Property="KeyboardNavigation.TabNavigation" Value="Continue"/>
</Style>
</TreeView.ItemContainerStyle>

<TreeViewItem>
<TreeViewItem.Header>
<TextBlock Text="First Block" FontWeight="Bold"/>
</TreeViewItem.Header>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" SharedSizeGroup="Column1"/>
<ColumnDefinition Width="5" SharedSizeGroup="Column2"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<Grid.RowDefinitions>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
</Grid.RowDefinitions>

<GridSplitter Grid.Column="1" Grid.RowSpan="4" Width="5" HorizontalAlignment="Left" VerticalContentAlignment="Stretch" IsTabStop="False"/>

<TextBlock Grid.Row="0" Grid.Column="0" Text="A"/>
<CheckBox Grid.Row="0" Grid.Column="2" IsChecked="{Binding A}"/>

<TextBlock Grid.Row="1" Grid.Column="0" Text="B"/>
<TextBox Grid.Row="1" Grid.Column="2" Text="{Binding B}" Width="200"/>

<TextBlock Name="PassBin" Grid.Row="2" Grid.Column="0" Text="C"/>
<ComboBox x:Name="CbxPassBin" Grid.Row="2" Grid.Column="2" ItemsSource="{Binding C}" SelectedValue="{Binding SelectedC}"/>
</Grid>
</TreeViewItem>
</TreeView>
</StackPanel>
</StackPanel>

最佳答案

TabIndex 应该是 1Focusable="true"

关于TreeViewItem 元素中的 C# 选项卡索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30886992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com