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 };