This is a migrated thread and some comments may be shown as answers.

Difference between Radcheckbox and RadchechboxElement

3 Answers 114 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Divya
Top achievements
Rank 1
Divya asked on 04 May 2011, 02:10 PM
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

3 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 09 May 2011, 03:21 PM
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.
0
Divya
Top achievements
Rank 1
answered on 10 May 2011, 05:27 AM
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

0
Ivan Todorov
Telerik team
answered on 10 May 2011, 05:00 PM
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.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Divya
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Divya
Top achievements
Rank 1
Share this question
or