New to Telerik UI for WinForms? Start a free 30-day trial
Prevent the control from gaining focus
Updated over 6 months ago
Currently, RadCommandBar receives the focus. One can easily override this behavior and do not allow the control to become focused. Here are the three simple steps that need to be followed:
-
Create a custom class that derives from RadCommandBar;
-
Override the ThemeClassName property, so that the theming mechanism can recognize the new control as a RadCommandBar;
-
Override the ProcessFocusRequested method and return false.
C#
class MyCommandBar : RadCommandBar
{
public override string ThemeClassName
{
get
{
return typeof(RadCommandBar).FullName;
}
}
protected override bool ProcessFocusRequested(RadElement element)
{
return false;
}
}