Catching events PreviewLostFocus

Docking/MDI for WPF Forum

Posted 9 years ago by Alexander Tokarenko
Version: 10.1.0523
Avatar
Hello.
I have some problems such as following. I have the simple XAML-code.

<docking:DockSite Grid.Row="2" Name="m_DockSite">

<docking:DockSite.AutoHideBottomContainers>
<docking:ToolWindowContainer>
<docking:ToolWindow Name="m_ToolWndOutput" Title="Output"/>
</docking:ToolWindowContainer>
</docking:DockSite.AutoHideBottomContainers>

<docking:SplitContainer>
<docking:ToolWindowContainer>
<docking:ToolWindow Name="m_ToolWnd1" Title="Tool Window 1"
PreviewLostKeyboardFocus="m_ToolWnd1_PreviewLostKeyboardFocus">
<StackPanel Orientation="Vertical">
<TextBox PreviewLostKeyboardFocus="TextBox_PreviewLostKeyboardFocus">
</TextBox>
<TextBox/>
</StackPanel>
</docking:ToolWindow>
<docking:ToolWindow Name="m_ToolWnd2" Title="Tool Window 2">
<StackPanel Orientation="Vertical">
<TextBox>

</TextBox>
</StackPanel>
</docking:ToolWindow>
</docking:ToolWindowContainer>

<docking:SplitContainer>

<docking:Workspace>
<docking:TabbedMdiHost>
<docking:TabbedMdiContainer>
<docking:DocumentWindow Title="Doc1">
<StackPanel>
<editors:DateTimeEditBox
Value="{x:Static system:DateTime.Now}"
Format="dd/MM/yyyy HH:mm:ss:fff"
ValueChanging="DateTimeEditBox_ValueChanging"
ValueChanged="DateTimeEditBox_ValueChanged"/>
<editors:DoubleEditBox SpinBehavior="SimpleWrap"
SpinnerVisibility="Visible" Minimum="0" Maximum="10"/>
</StackPanel>
</docking:DocumentWindow>
<docking:DocumentWindow Title="Doc2">
<StackPanel>
<TextBox/>
<TextBox/>
</StackPanel>
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>

<docking:ToolWindowContainer>
<docking:ToolWindow Name="m_ToolWnd3" Title="Tool Window 3" />
<docking:ToolWindow Name="m_ToolWnd4" Title="Tool Window 4" />
</docking:ToolWindowContainer>

</docking:SplitContainer>
</docking:SplitContainer>
</docking:DockSite>
And how you can see I have the TextBoxes in the ToolWindow. And I want to validate values in the TextBoxes before I switch to another window. And if the value isn't valid I want to set focus into the TextBox which keeps the invalid data. But when I use the validation rules and PreviewLostFocus events I only can catch the invalid values and show message boxes. But I can't prevent loosing the focus by the textbox when user switches between ToolWindow1 and ToolWindow2. Are there any way to resolve this problem?

Comments (1)

Posted 9 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This is more of a general WPF question, which has been discussed on Microsoft's forum.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.