Hi, I am building a custom splitbutton that consists of two overlapping buttons, and popup - like this (image shows some generic splitbutton):
My SplitButton opens popup whan a right side with arrow is clicked, and executes SplitButton.Command when a main button is clicked.
In my case however sometimes the default action cannot execute, and in those cases, when a main button is clicked, I'd like to open the popup instead.
I have accomplished it, but the problem is this:
- the SplitButton is subclassed from ToggleButton
- in a ControlTemplate, I have a ToggleButton (the bottom one), and Button (shorter, overlaid on the top)
Button.Command="{TemplateBinding Command}"
(so I can do<SplitButton Command="{Binding MyDefaultAction}">...
)- problem: when a command cannot execute, the whole SplitButton gets disabled.
I'd like to keep having the same command, but to override the button's behavior so that it doesn't become disabled when Command.CanExecute() returns false. How can I do this?
Thank you!