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

SelectionChanging/ SelectionChanged events are not fired once an e.Cancel is set to true in SelectionChanging handler

1 Answer 130 Views
Wizard
This is a migrated thread and some comments may be shown as answers.
Ahmed
Top achievements
Rank 1
Ahmed asked on 10 Aug 2015, 12:45 PM

I have used the wizard events to control my wizard navigation but once I cancel the navigation for one step using e.Cancel, The SelectionChanging/ SelectionChanged events doesn't  get fired. 

I was using the UI for WPF Q1 2015 and now updated to UI for WPF Q2 2015 but still the same problem exists.

 

check this code sample

 

using System.Windows;
using Telerik.Windows.Data;
using Telerik.Windows.Controls;

namespace WizardNavigation
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private ObservableItemCollection<WizardPage> collection;
        private int cancelCounter = 1;
        public MainWindow()
        {
            InitializeComponent();

            collection = new ObservableItemCollection<WizardPage>();

            var firstPage = new WizardPage {Content = "My First Page Content"};

            var secondPage = new WizardPage {Content = "My Second Page Content"};

            var thirdPage = new WizardPage {Content = "My Third Page Content"};

            var fourthPage = new WizardPage {Content = "My Fourth Page Content"};

            myWizard.WizardPages.Add(firstPage);
            myWizard.WizardPages.Add(secondPage);
            myWizard.WizardPages.Add(thirdPage);
            myWizard.WizardPages.Add(fourthPage);

            myWizard.Next += myWizard_Next;
            myWizard.SelectionChanging += myWizard_SelectionChanging;
        }

        void myWizard_SelectionChanging(object sender, SelectedPageChangingEventArgs e)
        {
            if (cancelCounter != 2) return;
            e.Cancel = true;
            MessageBox.Show("Cancelled, Click again to navigate");
        }

        void myWizard_Next(object sender, NavigationButtonsEventArgs e)
        {
            // You will need to click the next twice for to move to step 3.
            // SelectionChanging will not be called on the second click
            //SelectionChanging will be called when moving to forth step.
            cancelCounter++;

            var wizard = sender as RadWizard;
            
            if (wizard.SelectedPage.Content == "My First Page Content")
            {
                e.SelectedPageIndex = 2;
            }
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 11 Aug 2015, 01:22 PM
Hi Ahmed,

Thank you for reporting this bug. I have already fixed it and the fix will be included in our next internal build (next Monday).

Regards,
Yoan
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Wizard
Asked by
Ahmed
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or