WPF 工具包数据网格 - 自定义选项卡

发布于 2024-07-20 05:58:14 字数 111 浏览 2 评论 0原文

我有一个包含 3 列的 WPF 工具包 DataGrid。 只有第三列允许数据输入 - 前两列是静态的(文本描述)。 是否可以控制选项卡和导航,以便选项卡和上下左右按钮将忽略前两列并在第三列的范围内运行?

I have a WPF Toolkit DataGrid with 3 columns. Only the third column allows data entry - the first two are static (Text descriptions). Is it possible to control tabbing and navigation such that the tab and up-down-left-right buttons will ignore the first two columns and operate within the confines of the third?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的笑 2024-07-27 05:58:14

您可以使用 IsTabStop 属性禁用前两列上的 Tab 键切换。 不幸的是,这不像其他一些 WPF 控件那样容易访问,因此您必须通过 CellStyle 设置它:

</dg:DataGridTextColumn>
    <dg:DataGridTextColumn.CellStyle>
        <Style TargetType="{x:Type dg:DataGridCell}">
            <Setter Property="IsTabStop" Value="False" />
        </Style>
    </dg:DataGridTextColumn.CellStyle>
</dg:DataGridTextColumn>

You can disable tabbing on the first two columns with the IsTabStop property. Unfortunately this isn't as easy to access as some of the other WPF controls so you have to set it via the CellStyle:

</dg:DataGridTextColumn>
    <dg:DataGridTextColumn.CellStyle>
        <Style TargetType="{x:Type dg:DataGridCell}">
            <Setter Property="IsTabStop" Value="False" />
        </Style>
    </dg:DataGridTextColumn.CellStyle>
</dg:DataGridTextColumn>
故笙诉离歌 2024-07-27 05:58:14

这可能无法完全回答您的问题,但希望它能帮助您入门。 我遇到了 WPF Toolkit DataGrid 的一个错误,该错误在使用退格键清除单元格内容时插入了垃圾字符。 这让我找到了一篇关于该错误的 CodePlex 帖子,并且生成的方法覆盖(我对网格和列进行了子类化)使我能够绕过该问题。

这是让我开始的帖子:
http://wpf.codeplex.com/WorkItem/View.aspx?WorkItemId= 10246

我假设您可以捕获 Tab 键并仅在用户位于第三列时才传递它?

希望这会有所帮助 - 我对 WPF 比较陌生,所以仍在学习内部结构。

This may not fully answer your question, but hopefully it will get you started. I ran into a bug with the WPF Toolkit DataGrid that inserted a garbage character when using the backspace key to clear the cell's contents. This led me to a CodePlex post about the bug, and the resulting method overrides (I subclassed both the grid and the column) allowed me to bypass the problem.

Here is the post that got me started:
http://wpf.codeplex.com/WorkItem/View.aspx?WorkItemId=10246

I assume that you could trap the tab key and only pass it on if the user is in the third column?

Hope this helps - I am relatively new to WPF, so still learning the internals.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文