WPF Datagrid -DataGridTemplateColumn 选项卡焦点问题 [英] WPF Datagrid -DataGridTemplateColumn tab focus issue

查看:30
本文介绍了WPF Datagrid -DataGridTemplateColumn 选项卡焦点问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Microsoft WPF 数据网格.我注意到 WPF 数据网格 DataGridTemplateColumn 的一个奇怪行为.当您在网格中使用 templateColumn 并且模板列包含一些控件时,当您从前一列使用 Tab 键时,焦点不会自动赋予在模板列中声明的第一个元素.foucs 最初设置在模板列的边界上,当我们选择一次 agin 时,焦点会转到第一列.此问题的任何解决方法.当我关闭时,如何将焦点设置为数据网格模板列中的第一个元素.

I am using Microsoft WPF datagrid. I have noticed a strange behavior with WPF datagrid DataGridTemplateColumn. When you use the templateColumn in the grid and the template column contains some controls when you tab from the previous column the focus is not automatically given to the first element declared in the template column. The foucs is initally set on the border of the template column and when we tab of once agin the focus goes to the first column. Any workaround for this issue. How can i set the focus to go the first element in the template column of the datagrid when i tab off.

推荐答案

我们通过修改DataGridCell上的样式解决了这个问题:

We solved this problem by modifying the style on DataGridCell:

<Style x:Key="DataGridCellStyle" TargetType="{x:Type DataGridCell}">
    <Setter Property="IsTabStop" Value="False"/>

这篇关于WPF Datagrid -DataGridTemplateColumn 选项卡焦点问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆