public MainWindow() { VisualDiagnostics.EnableVisualTreeChanged(); VisualDiagnostics.VisualTreeChanged += VisualDiagnosticsOnVisualTreeChanged; InitializeComponent(); Binding.AddTargetUpdatedHandler(this, Handler); PrimaryRibbonModel model = new PrimaryRibbonModel(); var modelTab = new RibbonModelTab { Header = "Tab 1" }; model.RibbonItems.Add(modelTab); var group1 = new RibbonModelGroup { Label = "Group 1" }; // var modelControlGroup = new RibbonModelControlGroup(); // modelControlGroup.Items.Add(new RibbonModelButton() { Label = "Click me" }); // modelControlGroup.Items.Add(new RibbonModelButton() { Label = "Click me toos" }); var insertFruitcommand = TryFindResource("InsertFruitCommand") as ICommand; var group2 = new RibbonModelGroup { Label = "Fruit" }; var modelButton = new RibbonModelButton() { Label = "Strawberry", LargeImageSource = TryFindResource("Strawberry") }; modelButton.Command = insertFruitcommand; modelButton.CommandTarget = this; modelButton.CommandParameter = modelButton; group2.Items.Add(modelButton); var modelItem = new RibbonModelButton { Label = "Grapes", LargeImageSource = TryFindResource("Grapes"), Command = insertFruitcommand }; modelItem.CommandParameter = modelItem; group2.Items.Add(modelItem); modelItem.CommandTarget = this; var button = new RibbonModelButton() { Label = "Watermelon", LargeImageSource = TryFindResource("Watermelon") }; button.Command = insertFruitcommand; button.CommandTarget = this; button.CommandParameter = button; group2.Items.Add(button); var comboBox = new RibbonModelItemComboBox() { Label = "Fruit dropdown" }; var modelGallery = new RibbonModelGallery(); var modelGalleryCategory = CreateFruitGalleryCategory(); modelGallery.Items.Add(modelGalleryCategory); CommandBindings.Add(new CommandBinding(insertFruitcommand, Executed)); var cat1 = CreateFruitGalleryCategory(); cat1.Command = insertFruitcommand; cat1.CommandTarget = this; RibbonModelItemMenuButton FruitButton = new RibbonModelItemMenuButton() { Label = "Fruit Selector" }; var gallery = new RibbonModelGallery(); gallery.Items.Add(cat1); FruitButton.ItemsCollection.Add(gallery); group1.Items.Add(FruitButton); comboBox.Items.Add(modelGallery); group1.Items.Add(comboBox); // group1.Items.Add(modelControlGroup); modelTab.ItemsCollection.Add(group1); modelTab.ItemsCollection.Add(group2); DataContext = model; }
public void Test1() { PrimaryRibbonModel m = new PrimaryRibbonModel(); }