Пример #1
0
        private static void NamePropertyChanged(DependencyObject o, DependencyPropertyChangedEventArgs e)
        {
            string value = e.NewValue as string;

            IRibbonButton btn = o as IRibbonButton;

            if (btn != null)
            {
                btn.SmallImage = CreateImageSource(value, 16);
                btn.LargeImage = CreateImageSource(value, 32);
                return;
            }

            RibbonApplicationMenuItem apItem = o as RibbonApplicationMenuItem;

            if (apItem != null)
            {
                apItem.Image = CreateImageSource(value, 32);
                return;
            }

            RibbonMenuItem item = o as RibbonMenuItem;

            if (item != null)
            {
                item.Image = CreateImageSource(value, 16);
                return;
            }

            RibbonComboBox box = o as RibbonComboBox;

            if (box != null)
            {
                box.Image = CreateImageSource(value, 16);
                return;
            }

            RibbonTextBox tb = o as RibbonTextBox;

            if (tb != null)
            {
                tb.Image = CreateImageSource(value, 16);
                return;
            }

            throw new ArgumentNullException("RibbonSrc.Name can only by attached to controls that implement IRibbonButton.");
        }
Пример #2
0
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.ribbon = ((Odyssey.Controls.RibbonBar)(target));
     return;
     case 2:
     this.NewMenuItem = ((Odyssey.Controls.RibbonApplicationMenuItem)(target));
     return;
     case 3:
     this.OpenMenuItem = ((Odyssey.Controls.RibbonApplicationMenuItem)(target));
     return;
     case 4:
     this.SaveMenuItem = ((Odyssey.Controls.RibbonApplicationMenuItem)(target));
     return;
     case 5:
     this.contentRoot = ((WaveTech.Insight.InsightWpf.Classes.ProjectLocalizationRoot)(target));
     return;
     }
     this._contentLoaded = true;
 }