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

radDropDownListElement, What is getting fired.

1 Answer 116 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
Stephan
Top achievements
Rank 1
Stephan asked on 03 Aug 2012, 03:22 AM

 

 

I am using a ribbonbar and under my view tab I have a Theme Section with a radDropDownListElement.  I loaded it with all the Themes I want to allow, but when I run the application the following occurs.
the default value is blank, I would like it to show my current setting.
When I click on the dropdown all the themes I entered are visable.
When I select one the value changes visually on the screen to what is selected.
I have put breaks in the code below, but the application never stops.


 

 

private void radDropDownListElement1_SelectedValueChanged(object sender, EventArgs e)

 

 

{

 

 

    ThemeResolutionService.ApplicationThemeName = radDropDownListElement1.Name;

 

}

 

 

private void radDropDownListElement1_Click(object sender, EventArgs e)

 

{

 

 

    ThemeResolutionService.ApplicationThemeName = radDropDownListElement1.Name;

 

}


So the long and the short is how do I capture what is selected to get the theme to change for the user.

Thanks

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 07 Aug 2012, 01:33 PM
Hello Stephan,

Thank you for writing.

Here is a small example that provides the desired functionality (assuming that you have the themes already loaded):
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
 
        radDropDownListElement1.Items.Add("TelerikMetroBlue");
        radDropDownListElement1.Items.Add("Office2007Black");
        radDropDownListElement1.Items.Add("Office2010Silver");
        radDropDownListElement1.Items.Add("ControlDefault");
        radDropDownListElement1.SelectedIndex = radDropDownListElement1.FindString("ControlDefault");
        radDropDownListElement1.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(radDropDownListElement1_SelectedIndexChanged);
    }
 
    void radDropDownListElement1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
    {
        ThemeResolutionService.ApplicationThemeName = radDropDownListElement1.SelectedText;
    }
}

Let me know if you need further assistance with this case.

Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
RibbonBar
Asked by
Stephan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or