2

I am working in WPF with MVVM. I implemented WPF Extended Toolkit and I use ChildWindow, when I open the ChildWindow the property IsModal is enabled. But this property does not block navigating with Tab.

I need block the navigating with Tab when the ChildWindos is open.

I tried with Focusable property but does not serve.

CampDev
  • 1,659
  • 3
  • 16
  • 22
  • 1
    I tested this on a sample project and I agree with your observations.Is there any way you can use the Window class in System.Windows namespace and show it using ShowDialog method ?.I believe the tabbing works in the way expected by you.I will update the answer if I find a better alternative after looking in to the source code for the IsModal property in the ChildWindow control – Vasudevan Kannan Jun 08 '14 at 08:11
  • It seems the behavior is by design. The Modal layer only prevents the user from directly interacting with the control by clicking on it.I have created a new issue in the codeplex for this. https://wpftoolkit.codeplex.com/workitem/21062 – Vasudevan Kannan Jun 09 '14 at 20:44

2 Answers2

1

I understand your issue is with the tab in the background when show the ChildWindow.

You should try modifying the property KeyboardNavigation.TabNavigation of de Window.

If you use MVVM pattern do something like this in the XAML:

<Window
KeyboardNavigation.TabNavigation="{Binding TabNavigationMode}"
>

In the ViewModel:

private KeyboardNavigationMode _tabNavigationMode;
public KeyboardNavigationMode TabNavigationMode
{
  get { return _tabNavigationMode; }
  set { _tabNavigationMode = value; RaisePropertyChanged("TabNavigationMode");
}

And create a Method like this that is invoked when you open and close the Child Window

public void IsTabNavigationEnable(bool isEnable)
{
    if (isEnable) TabNavigationMode = KeyboardNavigationMode.Contained;
    else TabNavigationMode = KeyboardNavigationMode.None;
}

I tried it and it works fine. The tab is disabled in the background but not in the ChildWindow.

Ricardo Polo Jaramillo
  • 12,110
  • 13
  • 58
  • 83
0

This is a known issue and the extended tool kit team needs to work on it.In the mean time if you still like to implement this feature using the ChildWindow I would suggest to subscribe to PreviewKeyDown event and manually change the behavior of the tab and arrow keys when the childwindow goes modal.

The link for the issue is

https://wpftoolkit.codeplex.com/discussions/252462

Vasudevan Kannan
  • 911
  • 2
  • 7
  • 22