Can somebody tell me why the LostFocus event seems to be firing when the xamtexteditor control is actually gaining focus? I am using NetAdvantage for WPF 2008 Vol. 1. Clicking the Test button here and clicking back to the control fires the LostFocus. When you leave LostFocus is called again (which is as you would expect).
<Window x:Class="WpfApplication5.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igEditors="http://infragistics.com/Editors" Title="Window1" Height="300" Width="300"> <StackPanel> <igEditors:XamTextEditor LostFocus="XamTextEditor_LostFocus"></igEditors:XamTextEditor> <Button>Test</Button> </StackPanel></Window>
Hi,
It's because when the text editor receives focus, it passes it onto it's child textbox that's used for editing. This will cause its LostFocus to fire because it doesn't have focus anymore, although it's descendant element has it. Note that however IsFocusWithin property of the text editor will continue being true as the focus is still 'within' the control.
Hope this helps,
Sandip