示例#1
0
 private void InitialiseParagraphButtons()
 {
     this.boldButton = new RibbonToggleButtonData()
     {
         Label      = Messages.Edition_Bold,
         SmallImage = new Uri(imgUri.FormatWith("Bold"), UriKind.Relative),
         Command    = EditingCommands.ToggleBold,
     };
     this.italicButton = new RibbonToggleButtonData()
     {
         Label      = Messages.Edition_Italic,
         SmallImage = new Uri(imgUri.FormatWith("Italic"), UriKind.Relative),
         Command    = EditingCommands.ToggleItalic,
     };
     this.underlineButton = new RibbonToggleButtonData()
     {
         Label      = Messages.Edition_Underline,
         SmallImage = new Uri(imgUri.FormatWith("Underline"), UriKind.Relative),
         Command    = EditingCommands.ToggleUnderline,
     };
     this.bulletsButton = new RibbonButtonData()
     {
         Label      = Messages.Edition_Bullets,
         SmallImage = new Uri(imgUri.FormatWith("Bullets"), UriKind.Relative),
         Command    = EditingCommands.ToggleBullets,
     };
     this.numberingButton = new RibbonButtonData()
     {
         Label      = Messages.Edition_Numbering,
         SmallImage = new Uri(imgUri.FormatWith("Numbering"), UriKind.Relative),
         Command    = EditingCommands.ToggleNumbering,
     };
 }
示例#2
0
        private void InitialiseFontButtons()
        {
            this.leftAllignButton = new RibbonToggleButtonData()
            {
                Label      = Messages.Edition_LeftAlign,
                SmallImage = new Uri(imgUri.FormatWith("LeftAlign"), UriKind.Relative),
                Command    = EditingCommands.AlignLeft,
                Order      = 1,
            };
            this.rightAllignButton = new RibbonToggleButtonData()
            {
                Label      = Messages.Edition_RightAlign,
                SmallImage = new Uri(imgUri.FormatWith("RightAlign"), UriKind.Relative),
                Command    = EditingCommands.AlignRight,
                Order      = 2,
            };
            this.centerAllignButton = new RibbonToggleButtonData()
            {
                Label      = Messages.Edition_CenterAlign,
                SmallImage = new Uri(imgUri.FormatWith("CenterAlign"), UriKind.Relative),
                Command    = EditingCommands.AlignCenter,
                Order      = 3,
            };
            this.justifyAllignButton = new RibbonToggleButtonData()
            {
                Label      = Messages.Edition_JustifyAlign,
                SmallImage = new Uri(imgUri.FormatWith("JustifyAlign"), UriKind.Relative),
                Command    = EditingCommands.AlignJustify,
                Order      = 4,
            };

            this.fontsComboBox = new RibbonComboBoxData()
            {
                Label             = "Fonts",
                SelectionBoxWidth = 150,
                Order             = 5,
                DataContext       = Fonts.SystemFontFamilies,
            };

            this.fontsSizeComboBox = new RibbonComboBoxData()
            {
                Label             = "Font size",
                SelectionBoxWidth = 40,
                Order             = 6,
            };
        }
示例#3
0
        private void UpdateItemCheckedState(RibbonToggleButtonData button, DependencyProperty formattingProperty, object expectedValue)
        {
            object currentValue = TextEditor.Control.Selection.GetPropertyValue(formattingProperty);

            button.IsChecked = (currentValue == DependencyProperty.UnsetValue) ? false : currentValue != null && currentValue.Equals(expectedValue);
        }