【问题标题】:What stops the tab?是什么阻止了标签?
【发布时间】:2011-11-08 15:03:58
【问题描述】:

我有以下 xaml:

       <ListBox ItemsSource="{Binding Path=ItemProperties.GeneralProperties}" Grid.Row="1"
                 Margin="0" Style="{StaticResource ListBoxStyle1}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="180" />
                            <ColumnDefinition Width="320" />
                        </Grid.ColumnDefinitions>

                        <TextBlock Text="{Binding Name}" Grid.Column="0" />
                        <ContentPresenter Content="{Binding Converter={StaticResource PropertyInput}}" Grid.Column="1" />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

ContentPresenter 包含一个 TextBox、一个 ComboBox 或一个 CheckBox。

要在控件之间切换,我需要按两次选项卡。为什么???

我已经尝试在没有 TextBlock 的情况下评论整个第一列,但没有成功。

【问题讨论】:

  • 您的 ListBox 是否应用了 ListBoxItemStyle?您还需要检查输入控件的样式。

标签: silverlight xaml tabstop


【解决方案1】:

这对我来说适用于 DataGrid(它具有类似的模板系统)。

<UserControl.Resources>
    <Style TargetType="{x:Type DataGridCell}">
        <Setter Property="KeyboardNavigation.IsTabStop" Value="False"/>                                          
    </Style>
</UserControl.Resources>

然后,数据网格中的任何 TabStop 都将用作制表位,但仅此而已。抱歉,我不确定 ListBox 的等效代码是什么 - 但您也许可以从中弄清楚。

【讨论】:

    猜你喜欢
    • 2018-11-03
    • 1970-01-01
    • 2017-11-16
    • 1970-01-01
    • 1970-01-01
    • 2011-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多