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

No transition on certain conditions

1 Answer 64 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
Nick
Top achievements
Rank 1
Veteran
Nick asked on 13 Nov 2019, 04:11 AM

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?

 

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 14 Nov 2019, 11:57 AM

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.
Tags
TransitionControl
Asked by
Nick
Top achievements
Rank 1
Veteran
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or