I'm working on a data entry form that will be largely navigated with the keyboard, and I can't seem to get the RadButton to indicate focus. I can see in Theme Builder that it has states set that react to mouseover events, and I tried adding an Or condition to those states to make them activate when the mouse was over them OR the control had focus. That did nothing.
I also tried setting some different properties on the FocusPrimative element, and that didn't do anything either
I also tried setting some different properties on the FocusPrimative element, and that didn't do anything either
3 Answers, 1 is accepted
0
Hello JI-WON SUN,
There are two ways to show indicate focus on RadButton.
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
There are two ways to show indicate focus on RadButton.
- Set AllowShowFocusCues to true. This will draw a thin dotted frame in the button when the focus is on it. This frame cannot be customized (colors, width, etc).
- Use the FocusPrimitive to indicate focus. The focus conditions should be applied to the FocusPrimitive, but not to the FillPrimitive as you have probably tried. Such approach is used in our Vista theme - the aqua colored frame which appears when RadButton is focused is actually the FocusPrimitive. The properties which you need to use in your conditions are IsItemFocused and IsMouseOver. I am attaching RadButton Vista theme for your reference.
I hope this helps. If you have additional questions, feel free to contact me.
Best wishes,Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Emanuel Varga
Top achievements
Rank 1
answered on 26 May 2010, 10:14 AM
This solution is not working anymore (2010 Q1 SP2), is there a new way
to accomplish this?
On a sidenote, the focus is not visible (very poorly visible) on a button with a custom red gradient
I have attached the code generated by the designer, should i do something else to setup the focus? I don't mind the default color of the style, but i would like for it to be clearly visible.
Thank you,
Emanuel
On a sidenote, the focus is not visible (very poorly visible) on a button with a custom red gradient
this.deleteButton.ForeColor = System.Drawing.Color.White; |
this.deleteButton.Name = "deleteButton"; |
this.deleteButton.RootElement.ForeColor = System.Drawing.Color.White; |
this.deleteButton.Size = new System.Drawing.Size(96, 24); |
this.deleteButton.Text = "Delete"; |
((Telerik.WinControls.UI.RadButtonElement)(this.deleteButton.GetChildAt(0))).Text = "Delete"; |
((Telerik.WinControls.Primitives.FillPrimitive)(this.deleteButton.GetChildAt(0).GetChildAt(0))).BackColor2 = System.Drawing.Color.FromArgb(((int)(((byte)(252)))), ((int)(((byte)(126)))), ((int)(((byte)(126))))); |
((Telerik.WinControls.Primitives.FillPrimitive)(this.deleteButton.GetChildAt(0).GetChildAt(0))).BackColor3 = System.Drawing.Color.FromArgb(((int)(((byte)(253)))), ((int)(((byte)(94)))), ((int)(((byte)(94))))); |
((Telerik.WinControls.Primitives.FillPrimitive)(this.deleteButton.GetChildAt(0).GetChildAt(0))).BackColor4 = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(10)))), ((int)(((byte)(10))))); |
((Telerik.WinControls.Primitives.FillPrimitive)(this.deleteButton.GetChildAt(0).GetChildAt(0))).BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(215)))), ((int)(((byte)(215))))); |
I have attached the code generated by the designer, should i do something else to setup the focus? I don't mind the default color of the style, but i would like for it to be clearly visible.
Thank you,
Emanuel
0
Hello JI-WON SUN,
Indeed, our new Visual Style Builder does not support the FocusPrimitive of RadButton. We will address this issue in one of our next releases. For the time being, you can use the following approach to set the FocusPrimitive visible:
If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Indeed, our new Visual Style Builder does not support the FocusPrimitive of RadButton. We will address this issue in one of our next releases. For the time being, you can use the following approach to set the FocusPrimitive visible:
public
Form1()
{
InitializeComponent();
this
.radButton1.Enter +=
new
EventHandler(radButton1_Enter);
this
.radButton1.Leave +=
new
EventHandler(radButton1_Leave);
Color focusColor = Color.FromArgb(100, 100, 100);
FocusPrimitive focus = (FocusPrimitive)
this
.radButton1.ButtonElement.Children[3];
focus.ForeColor = focusColor;
focus.ForeColor2 = focusColor;
focus.ForeColor3 = focusColor;
focus.ForeColor4 = focusColor;
focus.InnerColor = focusColor;
focus.InnerColor2 = focusColor;
focus.InnerColor3 = focusColor;
focus.InnerColor4 = focusColor;
}
void
radButton1_Leave(
object
sender, EventArgs e)
{
this
.radButton1.ButtonElement.Children[3].Visibility = Telerik.WinControls.ElementVisibility.Hidden;
}
void
radButton1_Enter(
object
sender, EventArgs e)
{
this
.radButton1.ButtonElement.Children[3].Visibility = Telerik.WinControls.ElementVisibility.Visible;
}
If you have additional questions, feel free to contact me.
All the best,
Nikolay
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.