Hi all,
I am generating buttons in a VSTO Ribbon dynamically from the xml data. Now, I want to disable a button on a condition. Every thing seems to be correctly, but i dont know why that button is not disabling. Plz refer the following code.
if (docProp["IsSubmittedTDL"].Value.ToString().Equals("True"))
{
// After Loading the Xml file
XmlNodeList groupsList = xmlDoc.DocumentElement.SelectNodes("//DocumentGenerator/Groups/Group");
foreach (XmlNode group in groupsList)
{
bool iterate = true;
rGroup = new RibbonGroup();
XmlNodeList buttonElements = group.SelectNodes("Buttons");
foreach (XmlNode buttonList in buttonElements)
{
XmlNodeList buttons = buttonList.SelectNodes("Button");
foreach (XmlNode button in buttons)
{
rButton = new RibbonButton();
rButton.Name = button.SelectSingleNode("ButtonId").InnerText;
if (rButton.Name == "btnSubmit")
{
//Catch the SubmitButton and make it disable.
rButton.Enabled = false;
iterate = false;
break;
}
}
}
if (iterate == false)
break;
}
Any help will be greatly appreciated.
Thanks,
K.S.R Prasad
Loading
K S Reddi PrasadPosted Apr 21, 2011, 3:28 AM
I am creating all the groups and buttons dynamically from MyRibbon.cs file, Now, i need to disable the dynamic button on a certain condition.That condition i have shown in the Up given code.
Sam HobbsPosted Apr 20, 2011, 3:47 PM
Suthish NairPosted Apr 20, 2011, 10:20 AM