Dynamically Creating RibbonTabs and its Corresponding Groups with Buttons with ViewModel in WPF RRS feed

  • Question

  • Hi,

    I am Lakshman Siddireddy, learning WPF from few weeks. I am creating a RibbonWindow and wants to dynamically create RibbonTabs and its corresponding groups with buttons using ViewModel binding (already in Grid, Ribbon is added).

    I have created three Model Class:

    TabModel Class

     public class RibbonTabModel
            public string RibbonTabHeaderName { get; set; }

            public List<RibbonGroupModel> Groups { get; set; }

    GroupModel Class

      public class RibbonGroupModel
            public string  Name { get; set; }
            public List<RibbonButton> Buttons { get; set; }

    RibbonButton Class

    public class RibbonButton
            public string Name { get; set; }
            public string LargeImageSource { get; set; }

    ViewModel class

     public class RibbonViewModel
            public List<RibbonTabModel> RibbonTabs
                    return this.GetRibbonItems();

            private List<RibbonTabModel> GetRibbonItems()
                List<RibbonTabModel> result = new List<RibbonTabModel>();
                RibbonTabModel tab = new RibbonTabModel();
                tab.RibbonTabHeaderName = "File";
                tab.Groups = new List<RibbonGroupModel>();
                RibbonGroupModel grp = new RibbonGroupModel();
                grp.Name = "File Group";
                RibbonButton btn = new RibbonButton();
                btn.Name = "Button 1";
                btn.LargeImageSource = @"Images\LargeIcon.png";
                grp.Buttons = new List<RibbonButton>();
                return result;


    Please help in creating a XAML of RibbonWindow with RibbonViewModel class. I want everything in XAML, no code behind please.

    Thanks in Advance,

    Lakshman Siddireddy

    Sunday, April 10, 2016 3:05 PM

All replies