Пример #1
0
        public void InitRbControl()
        {
            RibbonControl rbnCtrl = ComponentManager.Ribbon;

            rbnCtrl.ClearAllTabs();
            // Init Panel Source
            RibbonPanelSource srcPanel = new RibbonPanelSource();

            srcPanel.Title = "";
            srcPanel.Id    = "CustomPanel";

            RibbonPanel panel = new RibbonPanel();

            panel.Source = srcPanel;

            string      XMLName          = "//Data_UI.xml";
            string      CurrentDirectory = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
            XmlDocument xmlDoc           = new XmlDocument();

            xmlDoc.Load(CurrentDirectory + XMLName);
            XmlNodeList = xmlDoc.DocumentElement.SelectNodes("/RadRibbonView/RadRibbonTab");
            ReadXml(XmlNodeList);


            StackPanel wrapPanel = new StackPanel();

            for (int i = 0; i < radRibbonTabs.Count; i++)
            {
                RibbonTab tab = new RibbonTab();
                tab.Title = radRibbonTabs[i].Header.ToString();
                tab.Id    = radRibbonTabs[i].Name;
                tab.Panels.Add(panel);
                tab.Name = radRibbonTabs[i].Name;
                rbnCtrl.Tabs.Add(tab);
                wrapPanel.Children.Add(radRibbonTabs[i]);
                wrapPanel.HorizontalAlignment = HorizontalAlignment.Stretch;

                panel.SetWPFControl(wrapPanel, "test");
            }
        }