Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Ribbonbar > Check RadCheckBoxElement without raising event

Not answered Check RadCheckBoxElement without raising event

Feed from this thread
  • Marco avatar

    Posted on Nov 29, 2011 (permalink)

    Hi,

    I want to initialize ToggleState or Checked property of the RadCheckBoxElement, which I placed in the RibbonBar control.
    Is there a chance to do this without raising the ToggleStateChanged event?

    Reply

  • Peter Peter admin's avatar

    Posted on Dec 1, 2011 (permalink)

    Hello Marco,

    Thank you for the writing.

    I would like to suggest subscribing to the event after the control is initialized, for example:

    radCheckBoxElement1.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On
     
    AddHandler radCheckBoxElement1.ToggleStateChanged, AddressOf ToggleStateChanged
     
    Sub ToggleStateChanged(sender as object, args as StateChangedEventArgs)
     
    End Sub

    I hope this helps.

    Kind regards,
    Peter
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

  • Marco avatar

    Posted on Dec 2, 2011 (permalink)

    Hello Peter,

    thank you for your reply.
    I made a fault, because in my logic I convert the RadItem, to the RadCheckBoxElement or the RadButtonElement, etc., with the as C# operator.
    The RadCheckBoxElement inherits from the RadButtonElement, so the event was subscibed twice.
    I corrected my logic like this example:

    foreach (RadItem radItem in items)
    {
        bool handled = false;
     
        RadRibbonBarGroup ribbonBarGroup = radItem as RadRibbonBarGroup;
        if (ribbonBarGroup != null && !handled)
        {
            this.InitializeRibbonBarItemsState(ribbonBarGroup.Items);
            handled = true;
        }
     
        RadRibbonBarButtonGroup ribbonBarButtonGroup = radItem as RadRibbonBarButtonGroup;
        if (ribbonBarButtonGroup != null && !handled)
        {
            this.InitializeRibbonBarItemsState(ribbonBarButtonGroup.Items);
            handled = true;
        }
     
        RadCheckBoxElement checkBoxElement = radItem as RadCheckBoxElement;
        if (checkBoxElement != null && !handled)
        {
            this.InitializeCheckBoxElement(checkBoxElement);
            handled = true;
        }
     
        RadDropDownListElement dropDownListElement = radItem as RadDropDownListElement;
        if (dropDownListElement != null && !handled)
        {
            this.InitializeRadDropDownListElement(dropDownListElement);
            handled = true;
        }
     
        RadButtonElement buttonElement = radItem as RadButtonElement;
        if (buttonElement != null && !handled)
        {
            this.InitializeButtonElement(buttonElement);
            handled = true;
        }
    }

    Best regards.
    Marco

    Reply

  • Peter Peter admin's avatar

    Posted on Dec 2, 2011 (permalink)

    Hello Marco,

    I am happy to hear that you managed to get it working.

    Do not hesitate to write me back if you have further questions.

    Best wishes,
    Peter
    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Ribbonbar > Check RadCheckBoxElement without raising event
Related resources for "Check RadCheckBoxElement without raising event"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]