我需要在運行時用來自數據庫的一些數據填充RibbonMenu控件。無法填充RibbonMenu
我把我的偏移: http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.ribbonmenu(v=vs.90).aspx
與代碼:
private void PopulateCustomerMenu()
{
// Add two sub-menus to EmployeeMenu and populate each sub-menu
// First sub-menu
RibbonMenu subMenu1 = new RibbonMenu(); //new RibbonMenu(); is underlined red
subMenu1.Dynamic = true;
subMenu1.Label = "A - M";
subMenu1.Items.Add(new RibbonToggleButton()); //new RibbonToggleButton() is as well
((RibbonToggleButton)subMenu1.Items.Last()).Label = "Hall, Don";
subMenu1.Items.Add(new RibbonToggleButton()); //new RibbonToggleButton() is as well
((RibbonToggleButton)subMenu1.Items.Last()).Label = "Valdez, Rachel";
CustomerMenu.Items.Add(subMenu1);
// Second sub-menu
RibbonMenu subMenu2 = new RibbonMenu(); //new RibbonMenu(); is as well
subMenu2.Dynamic = true;
subMenu2.Label = "N - Z";
subMenu2.Items.Add(new RibbonToggleButton()); //new RibbonToggleButton() is as well
((RibbonToggleButton)subMenu2.Items.Last()).Label = "Robinson, Alex";
CustomerMenu.Items.Add(subMenu2);
}
我唯一得到的是Visual Studio中說:「錯誤1無法創建抽象類或接口的實例'Microsoft.Office.Tools.Ribbon.RibbonMenu'C:\ Users \ Christoffer \ Documents \ Visual Studio 2010 \ Projects \ OutlookAddIn2 \ OutlookAddIn2 \ Ribbon1.cs 80 35 OutlookAddIn2「
我一直堅持過去15個小時,所以我打開任何東西....任何想法?
你送我正確的方向......經過一番頭疼我想通過「Microsoft.Office.Tools.Common」做到這一點正確的方式(看我的回答) – chjortlund
我必須等6個小時才能用實際工作的新代碼回答我自己的問題。 – chjortlund