This is an old revision of the document!


Focus Scopes

Sometimes, controls need to be grouped into focus scopes so that there is always a focused control in that group, irrespective of the actual keyboard focus (there can only be one keyboard focused control in an application at any given time).

To create a focus scope, make a parent control:

<StackPanel Name="pnlsideButtonsMain" FocusManager.IsFocusScope="True">
    <Button.../>
    <Button.../>
    <Button.../>
</StackPanel>

Programmatically, in C#:

StackPanel pnlsideButtonsMain= new StackPanel();  
FocusManager.SetIsFocusScope(pnlsideButtonsMain, true);