No transition on certain conditions

2 posts, 0 answers
  1. Nick
    Nick avatar
    1 posts
    Member since:
    Oct 2019

    Posted 12 Nov 2019 Link to this post

    Hi All
    I would like to prevent the transition control from showing any transition/animation under certain conditions. For example, the content is bound to an enum field, for certain enum values I dont want it to transition.
    I have tried using IValueConverter     

    public class DispatchContentTransitionConverter : IValueConverter
        {
            public TransitionProvider TransitionForward { get; set; }
            public TransitionProvider TransitionBackward { get; set; }
            public TransitionProvider NoTransition { get; set; }
     
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                if (value == null) return NoTransition;
                KeyValuePair<int, string> OSDispatchStatus = (KeyValuePair<int, string>)value;
                if (OSDispatchStatus.Key == SettingsConsts.OS_DispatchStatus_ReadytoBookCollection)
                {
                    return TransitionForward;
                }
                else
                {
                    return NoTransition;
                }
            }
     
            public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }

     

    But for this option I cannot set a "No Transition" transition

    Second option tried: Setting Duration of the transition on TransitionStatusChanged, but this option only applies to the "Next" transition called not the current

    private void MainTransControl_TransitionStatusChanged(object sender, Telerik.Windows.Controls.TransitionControl.TransitionStatusChangedEventArgs e)
           {
               OrderDispatchModel VM = DataContext as OrderDispatchModel;
               if (VM != null )
               {
                   if (VM.OSDispatchStatus.Key == SettingsConsts.OS_DispatchStatus_ReadytoBookCollection)
                   {
                       this.MainTransControl.Duration = new TimeSpan(0, 0, 1);
                   }
                   else
                   {
                       this.MainTransControl.Duration = new TimeSpan(0, 0, 0);
                   }
               }
               else
               {
                   this.MainTransControl.Duration = new TimeSpan(0, 0, 0);
               }
           }

     

    Anyone have any ideas of how to implement this?

     

  2. Vladimir Stoyanov
    Admin
    Vladimir Stoyanov avatar
    541 posts

    Posted 14 Nov 2019 Link to this post

    Hello Nick,

    Thank you for the provided code snippets.

    Please, check out the TriggeringTransion event of the RadTransitionControl. It allows you to cancel a transition before it has started. 

    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