UIElement.LostFocus is worthless event. ToolTipService has issues. RRS feed

  • Question

  • I have a custom control that uses a ContentControl that is very dynamic and uses different DataTemplate to render different UI. I've wired into the lost focus and got focus event. As soon as the got focus is fired the lost focus gets fired which shouldn't be happing, so naturally I want to debug the problem. Here is where UIElement falls short. LostFocus event args do not provide any information of what control just took the focus from you which I think would be duh! we should let user know that( Silverlight, wpf, windows phone, all "should" have it), but whatever. So I know from WPF that I can just walk the visual tree and look at each UIElement.IsFocused property and when I find the true value I can then start debugging the problem, however WinRT does not provide a UIElement.IsFocused property leaving me with no way to figure out which control took focus from my control. I've gone through all the controls I could find setting IsTabStop=false to all of them and still my control is losing focus. I finally started commenting out xaml from my custom control and found that the issue is being caused by ToolTipService after several seconds of having focus somehow the tooltipservice causes something else to gain focus making my control lose focus. I don't think tooltipservice should be interfering with focus. please look into this issue. P.S. This control works fine in WPF & Silverlight which don't have this focus event issue that I'm seeing in WinRT platform.


    Wednesday, October 16, 2013 5:40 PM