views:

492

answers:

2

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?

Thank you Jason

A: 

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.

StrayPointer
+2  A: 

It is possible to turn off tabbing on the first two columns by using IsTabStop property on the individual DataGridCell items. 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>
Bermo