How to prevent element of custom control from getting focus?
c#, custom-controls, focus, wpf
Solution
Try setting `KeyboardNavigation.TabNavigation="None"` in the `DockPanel` or the `InfoIcon` itself.
Problem
I wrote a small WPF control - a textbox displaying small (i) icon allowing to display popup help. The relevant part of the control template looks like the following: ``` <DockPanel> <local:InfoIcon DockPanel.Dock="Right" Margin="2" VerticalAlignment="Center" HelpContent="{TemplateBinding InfoTooltip}" Focusable="False" IsTabStop="False"/> <ScrollViewer x:Name="PART_ContentHost" Margin="2" VerticalAlignment="Center"/> </DockPanel> ``` The `InfoIcon` have `IsTabStop` and `Focusable` explicitly set to false. But that doesn't prevent that control from getting focus while tabbing through controls: How can I prevent this part of CustomControl from getting focus?