Completed
Last Updated: 18 Jun 2014 08:12 by ADMIN
ADMIN
Stefan
Created on: 12 Feb 2014 16:18
Category: UI Framework
Type: Bug Report
0
FIX. RadCheckBox - RadCheckBoxAccessibleObject's DoDefaultAction method is not working
To reproduce:
Inspect a RadCheckBox with UI Spy or Inspector and execute the DoDefaultAction method. You will see that nothing will happen.


Workaround:
Use the following classes:


public class RadCheckBoxEx : RadCheckBox
{
    protected override AccessibleObject CreateAccessibilityInstance()
    {
        return new RadCheckBoxAccessibleObjectEx(this, this.Name);
    }
}


public class RadCheckBoxAccessibleObjectEx : RadCheckBoxAccessibleObject
{
    public RadCheckBoxAccessibleObjectEx(RadCheckBox owner, string name)
        : base(owner, name)
    {
    }


    public override void DoDefaultAction()
    {
        (this.OwnerElement as RadCheckBox).ToggleState = this.GetNextToggleState((this.OwnerElement as RadCheckBox).ToggleState);
    }


    private ToggleState GetNextToggleState(ToggleState toggleState)
    {
        if (toggleState == ToggleState.On)
        {
            if ((this.OwnerElement as RadCheckBox).IsThreeState)
            {
                return ToggleState.Indeterminate;
            }


            return ToggleState.Off;
        }
        else if (toggleState == ToggleState.Indeterminate)
        {
            return ToggleState.Off;
        }


        return ToggleState.On;
    }
}
0 comments