Reputation: 1659
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.
Upvotes: 2
Views: 270
Reputation: 12338
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.
Upvotes: 1
Reputation: 951
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
Upvotes: 0