Home » Blog

rounded header

Tabbing within a WPF Property Grid editor

Here’s a quick tip if you’re creating editors for the WPF Property Grid that contain more than one control. If you want to support tab key navigation between the controls, add the KeyboardNavigation.TabNavigation attached property to the container of the controls, and set it to Local. For example:

<DataTemplate x:Key="PhoneNumberEditor">
  <StackPanel Orientation="Horizontal"
              KeyboardNavigation.TabNavigation="Local">
    <TextBlock>+</TextBlock>
    <ms:TextBox Text="{Binding Path=CountryCode, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" MinWidth="10" />
    <TextBlock> (</TextBlock>
    <ms:TextBox Text="{Binding Path=RegionCode, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" MinWidth="10" />
    <TextBlock>) </TextBlock>
    <ms:TextBox Text="{Binding Path=Number, UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" MinWidth="10" />
  </StackPanel>
</DataTemplate>

Notice the additional attribute on the StackPanel element.

Leave a Reply

Data Products Visual Controls Community Store
LightSpeed ORM
NHibernate Designer
SimpleDB Tools
SharePoint Tools
WPF Elements
WPF Diagrams
Silverlight Elements
Forums
Blog
Register
Login
Subscribe to newsletter
Buy Now
My Account
Volume Discounts
Purchase Orders
Contact Us