RibbonHeaderImagem and ToolStripComboBoxEx

In my Application a have need create a ToolStripComboBoxEx, that load all RibbonHeaderImagem Members, as String Name (e.g. Birds, Boxes3D, Bubbles, etc.) and when user change de SelectionIndex, the RibbonHeaderImage change too, with base in SelectionIndex of the ToolStripComboBoxEx.
Thanks in advance for the help

3 Replies

SK Senthil Kumaran Rajan Syncfusion Team August 6, 2018 11:21 AM UTC

Hi William, 
 
Thank you for using Syncfusion products. 
 
We have prepared the sample for the reported requirement in RibbonControlAdv. Please make use of the below code example. 
 
Code Example[C#]: 
 
private void Form1_Load(object sender, EventArgs e) 
        { 
            // Add the RibbonHeaderImage items in ToolStripComboBox 
            foreach (RibbonHeaderImage item in Enum.GetValues(typeof(RibbonHeaderImage))) 
            { 
                this.toolStripComboBox1.Items.Add(item); 
            } 
        } 
 
        private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e) 
        { 
            if (this.toolStripComboBox1.SelectedItem != null) 
            { 
                this.ribbonControlAdv1.RibbonHeaderImage = (RibbonHeaderImage)Enum.Parse(typeof(RibbonHeaderImage), this.toolStripComboBox1.SelectedItem.ToString()); 
            } 
        } 
 
 
Please download the sample from below link. 
 
 
Regards, 
Senthil


WR William Rodrigues August 6, 2018 01:34 PM UTC

Hi Senthil
I was able to create a simpler code that answered me perfectly. Below I share:
Thanks
private void Form1_Load(object sender, EventArgs e) 
{
    Type oRBHI = typeof(RibbonHeaderImage);
    Type RBStyle = typeof(RibbonStyle);
    tsCBHeadTheme.Items.AddRange(oRBHI.GetEnumNames());
    tsCBTheme.Items.AddRange(RBStyle.GetEnumNames());
    tsCBHeadTheme.SelectedIndex = rcaMain.RibbonHeaderImage;
    tsCBTheme.SelectedIndex = rcaMain.RibbonStyle;
}

private void tsCBHeadTheme_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (tsCBHeadTheme.SelectedItem != null)
            rcaMain.RibbonHeaderImage = tsCBHeadTheme.SelectedIndex;
    }

    private void tsCBTheme_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (tsCBTheme.SelectedItem != null)
            rcaMain.RibbonStyle = tsCBTheme.SelectedIndex;
    }



SK Senthil Kumaran Rajan Syncfusion Team August 7, 2018 05:46 AM UTC

Hi William, 
  
Thank you for your update. 
  
We are glad to know that, your requirement has been achieved. Please let us know if you need any further assistance, we will be happy to assist you. 
  
Regards, 
Senthil 
 


Loader.
Up arrow icon