Focus cue for RadCheckbox with no label

3 posts, 0 answers
  1. Lou
    Lou avatar
    64 posts
    Member since:
    Aug 2014

    Posted 10 Feb 2015 Link to this post

    Hi, I have some RadCheckboxes that have no labels. When I tab to them there is no visual indication that these checkboxes have focus. Is there a way to do this?
    I do have "AllowShowFocusCues" set to True.

    Thanks,

    -Lou
  2. Hristo
    Admin
    Hristo avatar
    811 posts

    Posted 13 Feb 2015 Link to this post

    Hello Lou,

    Thank you for writing.

    In this case I would suggest that you subscribe to the GotFocus and LostFocus events. In the handlers you can define a proper setting so that it will become obvious if the check box is on focus or not. In my example I am changing the ForeColor property of the CheckMarkPrimitive object. Please refer to the following sample: 
    public partial class Form1 : Form
    {
        private Color defaultColor;
         
        public Form1()
        {
            InitializeComponent();
     
            this.radCheckBox1.GotFocus +=radCheckBox_GotFocus;
            this.radCheckBox1.LostFocus += radCheckBox_LostFocus;
            this.radCheckBox2.GotFocus += radCheckBox_GotFocus;
            this.radCheckBox2.LostFocus += radCheckBox_LostFocus;
            this.radCheckBox3.GotFocus += radCheckBox_GotFocus;
            this.radCheckBox3.LostFocus += radCheckBox_LostFocus;
        }
     
        private void radCheckBox_LostFocus(object sender, EventArgs e)
        {
            RadCheckBox checkBox = sender as RadCheckBox;
            checkBox.ButtonElement.CheckMarkPrimitive.Border.ForeColor = this.defaultColor;
        }
     
        private void radCheckBox_GotFocus(object sender, EventArgs e)
        {
            RadCheckBox checkBox = sender as RadCheckBox;
            this.defaultColor = checkBox.ButtonElement.CheckMarkPrimitive.Border.ForeColor;
            checkBox.ButtonElement.CheckMarkPrimitive.Border.ForeColor = Color.Red;
        }
    }

    I am also attaching a gif file showing the result on my end.

    I hope this helps. Should you have further questions, please do not hesitate to write back.


    Regards,
    Hristo Merdjanov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Lou
    Lou avatar
    64 posts
    Member since:
    Aug 2014

    Posted 13 Feb 2015 in reply to Hristo Link to this post

    That's cool - thanks for the help Hristo.

    -Lou
Back to Top