How can i always enable ToggleButton of RadRibbonSplitbutton when CanExecute of Command returns false

1 Answer 113 Views
Buttons RibbonView and RibbonWindow
Daniel
Top achievements
Rank 1
Daniel asked on 21 Sep 2021, 07:44 AM

Hi,

i try to always enable the DropDown-Part (the ToggleButton to open the drop down content) of RadRibbonSplitbutton even if the CanExecute of the binded command returns false. How can i achieve this behavior?

i have tried to set IsEnabled of the RadToggleButton via TogglePartStyle of RadRibbonSplitButton but didnt work.

 

<Style x:Key="SplitButtonToggleStyle" TargetType="telerik:RadToggleButton">
    <Setter Property="IsEnabled" Value="True"/>
</Style>

<Style TargetType="telerik:RadRibbonSplitButton" BasedOn="{StaticResource {x:Type telerik:RadRibbonSplitButton}}">
    <Setter Property="TogglePartStyle" Value="{StaticResource SplitButtonToggleStyle}"/>
</Style>

 

Thanks for your help!

Best regards,

Daniel

1 Answer, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 23 Sep 2021, 12:27 PM

Hello Daniel,

A possible approach for achieving this behavior has been described in the following article: Selectively Enabling Child Elements in a Disabled Panel.

As explained, however, for the purpose you would need to create a custom control which overrides the coerce logic.

For your convenience, I've gone ahead and prepared a small sample project where I create a custom RadToggleButton and replace the default button in the control template of the RadRibbonSplitButton with it. Please note that I've done this for the Office 2016 theme and if you're using another theme you'd need to extract and modify the control template accordingly.

Please have a look and let me know if this provides the desired result.

Regards,
Dilyan Traykov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Buttons RibbonView and RibbonWindow
Asked by
Daniel
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or