Prevent Double-Clicking on any RibbonView Button

2 posts, 0 answers
  1. Chloe
    Chloe avatar
    7 posts
    Member since:
    Feb 2019

    Posted 14 Mar Link to this post

    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, 

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    460 posts

    Posted 19 Mar Link to this post

    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.
Back to Top