Quantcast
Channel: Ribbon for WPF - Recent Posts
Viewing all articles
Browse latest Browse all 1458

Own commands for "Text Highlight Color" and "Font Color" buttons

$
0
0

Hello,

in your samples there is for Text Highlight Color:

<ribbon:SplitButton Command="sample:ApplicationCommands.ApplyDefaultForeground" KeyTipAccessText="FC"><StackPanel><ribbon:ColorPickerGallery InitialColumnCount="10" HorizontalAlignment="Center"
Command="sample:ApplicationCommands.ApplyForeground" IsPreviewEnabled="True"><ribbon:ColorPickerGallery.CategorizedItemsSource><x:Array Type="{x:Type media:SolidColorBrush}"><media:SolidColorBrush ribbon:PopupGallery.Category="Theme Colors" ribbon:ColorPickerGallery.LayoutBehavior="Shaded" Color="#FFFFFF" ribbon:ScreenTipService.ScreenTipHeader="White" /><media:SolidColorBrush ribbon:PopupGallery.Category="Theme Colors" ribbon:ColorPickerGallery.LayoutBehavior="Shaded" Color="#000000" ribbon:ScreenTipService.ScreenTipHeader="Black" /><media:SolidColorBrush ribbon:PopupGallery.Category="Theme Colors" ribbon:ColorPickerGallery.LayoutBehavior="Shaded" Color="#EEECE1" ribbon:ScreenTipService.ScreenTipHeader="Tan" /><media:SolidColorBrush ribbon:PopupGallery.Category="Standard Colors" Color="#7030A0" ribbon:ScreenTipService.ScreenTipHeader="Purple" /></x:Array></ribbon:ColorPickerGallery.CategorizedItemsSource></ribbon:ColorPickerGallery></StackPanel></ribbon:SplitButton>

The aplied command in the sample for this is:

		public static RibbonCommand ApplyDefaultBackground {
			get {
				if (applyDefaultBackground == null)
					applyDefaultBackground = new RibbonCommand("ApplyDefaultBackground", typeof(Ribbon), "Text Highlight Color", null, "pack://application:,,,/SampleBrowser;component/Resources/Images/TextHighlightColor16.png");				
				return applyDefaultBackground;
			}
		}

 This piece of code changes in the richtexbox the backgroud of the selected text. Also changes the fill color of litle rectangle below the icon.

My request is how can I use some own command? Because instead of richtextbox I have another control color to be changed after clicking this button. In my own command I would like to use also the TextHighlightColor16.png of the sample so the little rectangle can be updated after selecting some color from the picker color.

Thanks for your help.


Viewing all articles
Browse latest Browse all 1458