开发者

WPF Disabling TabStop for ObjectDataProvider

I have a ObjectDataProvider of check boxes:

<UserControl.Resources>
        <ObjectDataProvider x:Key="checkboxes" ObjectType="{x:Type Models:Items}" />
        <DataTemplate x:Key="Item" DataType="Models:Item" >
            <CheckBox Content="{Binding Path=Name}" IsChecked="{Binding Path=Include}" />
        </DataTemplate>
        <ItemsPanelTemplate x:Key="HorizontalList" >
            <StackPanel Orientation="Horizontal" />
        </ItemsPanelTemplate>
    </UserControl.Resources>

When I tab through the controls and get to the datatemplate, it looks selects the it before going to the controls inside, like this -

WPF Disabling TabStop for ObjectDataProvider

Is there any way to turn this off?

Conclusion

It isn't the ObjectDataProvider, but rather the ItemsControl that needs to be turned off -

<ItemsControl ItemsSource="{Binding ElementName=contain开发者_JAVA百科er,Path=ViewModel.Items}"
                          ItemTemplate="{StaticResource Item}"
                          ItemsPanel="{StaticResource HorizontalList}"
                          IsTabStop="False"/>

Thanks!


There is no problem with ObjectDataProvider in your code, just try to set IsTabStop = false in the container where CheckBoxes are. can you provide more xaml code from UserControl?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜