This is a migrated thread and some comments may be shown as answers.

Prevent Double-Clicking on any RibbonView Button

1 Answer 209 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Chloe
Top achievements
Rank 2
Chloe asked on 14 Mar 2019, 04:15 PM

Hi, 

I was wondering if there was any way to prevent double clicking on button? 

Currently, when my user double-click on any button in my RibbonView, it tries and starts the process twice, and depending of the process, crashes the app. Is there a way to disable the button until the action is done being executed? 

<telerik:RadRibbonButton Command="{Binding AddTravelClaimCommand}" Text="{DynamicResource TravelClaim.NewButton}" LargeImage="{StaticResource icon_addEvent}" Visibility="{Binding CanAddTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}" ClickMode="Press" />
                    <telerik:RadRibbonButton Command="{Binding ViewTravelClaimCommand}" Content="{DynamicResource TravelClaim.ViewButton}" LargeImage="{StaticResource icon_preview}" Visibility="{Binding CanViewTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <telerik:RadRibbonButton Command="{Binding EditTravelClaimCommand}" Text="{DynamicResource TravelClaim.EditButton}" LargeImage="{StaticResource icon_edit}" Visibility="{Binding CanEditTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <telerik:RadRibbonButton Command="{Binding ViewTravelClaimHistoryCommand}" Content="{DynamicResource TravelClaim.ViewHistoryButton}" LargeImage="{StaticResource icon_history}" Visibility="{Binding CanViewTravelClaimHistory, Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <telerik:RadRibbonButton Command="{Binding WithdrawTravelClaimCommand}" Content="{DynamicResource TravelClaim.WithdrawButton}" LargeImage="{StaticResource icon_withdraw}"  Visibility="{Binding CanWithdrawTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}"/>
                    <telerik:RadRibbonButton Command="{Binding DeleteTravelClaimCommand}" Content="{DynamicResource TravelClaim.DeleteButton}" LargeImage="{StaticResource icon_delete}" Visibility="{Binding CanDeleteTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}" />
                    <telerik:RadRibbonButton Command="{Binding CancelTravelClaimCommand}" Content="{DynamicResource TravelClaim.CancelButton}" LargeImage="{StaticResource icon_cancel}" Visibility="{Binding CanCancelTravelClaim, Converter={StaticResource BooleanToVisibilityConverter}}" />

 

Thank you so much, 

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 19 Mar 2019, 10:48 AM
Hello Chloe,

Thank you for the provided code snippet. 

Speaking generally, the RadRibbonButtons do not differ from normal WPF buttons in terms of the ICommandSource implementation. With this in mind, you can tackle the problem in the same way as you would for a normal WPF Button. 

Here are some forum threads which give ideas on this scenario:

Disable WPF buttons during longer running process, the MVVM way
WPF disable command for a while it running

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
RibbonView and RibbonWindow
Asked by
Chloe
Top achievements
Rank 2
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or