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

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

$
0
0

Hello,

I have done in similar way as you adviced. The splitbutton is created dynamically in code, The command for that is set as in the sample, but in the ApplyForegroundExecute I get for e.Parameter not BrushValueCommandParameter but ICheckableCommandParameter. How can I set the BrushValueCommandParameter when creating the splitbutton dynamically? Or am I missing something else?

        public static void ApplyForegroundExecute(object target, ExecutedRoutedEventArgs e)
        {
            GcSpreadSheet spreadSheet = target as GcSpreadSheet;
            if (spreadSheet == null) return;

            BrushValueCommandParameter parameter = e.Parameter as BrushValueCommandParameter;

The splitbutton is created this way:

                                ColorPicker colorPicker = new ColorPicker();
                                SplitButton splitButton = new SplitButton
                                {
                                    Id = commandModel.Id,
                                    ImageSourceLarge = renderTargetBitmap,
                                    ImageSourceSmall = renderTargetBitmap,
                                    Command = commandModel.Command,
                                    //CommandParameter = new BrushValueCommandParameter(), // not helped
                                    Label = commandModel.Caption,
                                    PopupContent = colorPicker
                                };

Viewing all articles
Browse latest Browse all 1458

Trending Articles