Difference between Radcheckbox and RadchechboxElement

4 posts, 0 answers
  1. Divya
    Divya avatar
    47 posts
    Member since:
    Mar 2011

    Posted 04 May 2011 Link to this post

    Hi,
                 I have used Radcheckbox  i have RightToLeftChanged event ,but inside a ribbion bar group i have added RadCheckboxElement for that i dont have RightToLeftChanged event.Why is it so



    What is the difference can anyone explain me and how can i implement RightToLeftChanged event for RadCheckBoxElemnt.


    Thanks
    Divya
  2. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 09 May 2011 Link to this post

    Hi Divya,

    Thank you for your question.

    The difference between RadCheckBox and RadCheckBoxElement is that RadCheckBox inherits from RadControl and RadCheckBoxElement inherits from RadElement. RadControl itself inherits from the .NET framework class Control which provides the basic functionality for controls. RightToLeftChanged event is inherited from the Control class. RadElement represents visual element which is used to form the layout of any RadControl. For example: RadCheckBox is a RadControl and its main element is RadCheckBoxElement. This is how our Telerik Presentation Framework is designed. You can find more information about the TPF on this link.

    In your case, in order to be notified when the RightToLeft  property of the RadCheckBoxElement is changed, you should subscribe to the following event:
    checkBoxElement.RadPropertyChanged += new Telerik.WinControls.RadPropertyChangedEventHandler(checkBoxElement_RadPropertyChanged);
    void checkBoxElement_RadPropertyChanged(object sender, Telerik.WinControls.RadPropertyChangedEventArgs e)
    {
        if (e.Property == RadElement.RightToLeftProperty)
        {
           //your logic goes here
        }
    }

    I hope this helps. Feel free to ask if you have any additional questions.

    Greetings,
    Ivan Todorov
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Divya
    Divya avatar
    47 posts
    Member since:
    Mar 2011

    Posted 10 May 2011 Link to this post

    Hi,
                I am getting error like checkboxelement_RadPropertyChanged does not exist .why is it so and like radcheckbox theme i want to write for radcheckboxelement how can i write


    For Radcheckbox i have written

    private

     

     

    void radCheckBox1_RightToLeftChanged(object sender, EventArgs e)

     

     

    {

     

     

     

    // ThemeResolutionService.LoadPackageResource("C:\\Documents and Settings\\Divya\\Desktop\\New Folder\\MyControlDefault.tssp");

     

     

     

    if (this.radCheckBox1.RightToLeft == System.Windows.Forms.RightToLeft.Yes)

     

     

    {

     

     

     

    this.radCheckBox1.ThemeName = "CheckBoxTheme";  //this is theme i hav created

     

     

    }

     

     

     

    else

     

    {

     

     

    this.radCheckBox1.ThemeName = "ControlDefault";

     

     

    }

     

     

     

    }



    now in the same way how can i write for radcheckboxelemnt because for radcheckbox i am not able to find themename property so can u explain how to do it



    Thanks
    Divya

  5. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 10 May 2011 Link to this post

    Hello Divya,

    Below is the whole code of my Form1.cs example:
    using System.Windows.Forms;
    using Telerik.WinControls;
     
    namespace Samples
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
                this.radCheckBoxElement1.RadPropertyChanged += new Telerik.WinControls.RadPropertyChangedEventHandler(radCheckBoxElement1_RadPropertyChanged);
            }
     
            void radCheckBoxElement1_RadPropertyChanged(object sender, Telerik.WinControls.RadPropertyChangedEventArgs e)
            {
                if (e.Property == RadElement.RightToLeftProperty)
                {
                    if (this.radCheckBoxElement1.RightToLeft)
                    {
                        ((RadControl)this.radCheckBoxElement1.ElementTree.Control).ThemeName = "MyControlDefault";
                    }
                    else
                    {
                        ((RadControl)this.radCheckBoxElement1.ElementTree.Control).ThemeName = "ControlDefault";
                    }
                }
            }
        }
    }

    Here you can see how to access the control that contains given element, as well as how to be notified when the RightToLeft property of RadElement has changed.

    I hope this helps. Feel free to ask if you have any further questions.

    Greetings,
    Ivan Todorov
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Back to Top