예제 #1
0
        private void OnItemSourceChanged(Wizard wizard, AvaloniaPropertyChangedEventArgs e)
        {
            if (Items == null)
            {
                Items = new AvaloniaList <WizardPage>();
            }

            if (e.NewValue == null)
            {
                return;
            }

            var list = e.NewValue as IEnumerable <IWizardPageVM>;

            if (list != null)
            {
                foreach (IWizardPageVM wizardPageVM in list)
                {
                    IWizardPageVM vm         = wizardPageVM as IWizardPageVM;
                    WizardPage    wizardPage = new WizardPage();
                    wizardPage.DataContext = vm;
                    wizardPage.CanCancel   = CanCancel;
                    (this.Items as AvaloniaList <WizardPage>).Add(wizardPage);
                }
            }
        }
예제 #2
0
 private void WizardPage_DataContextChanged(object sender, EventArgs e)
 {
     if (this.DataContext is IWizardPageVM)
     {
         IWizardPageVM wizardPageVM = this.DataContext as IWizardPageVM;
         Title       = wizardPageVM.Title;
         Description = wizardPageVM.Description;
         PageType    = wizardPageVM.PageType;
     }
 }
예제 #3
0
        private void OnCurrentWizardPageVM(Wizard o, AvaloniaPropertyChangedEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            IWizardPageVM wizardPageVM = e.NewValue as IWizardPageVM;

            CurrentPage = this.Items.OfType <WizardPage>().FirstOrDefault(x => x.DataContext == wizardPageVM);
        }
예제 #4
0
        private void ExecutePreviousPageCommand()
        {
            IWizardPageVM previousPage      = null;
            var           currentIndex      = WizardPages.IndexOf(CurrentPage);
            var           previousPageIndex = currentIndex - 1;

            if (previousPageIndex >= 0 && previousPageIndex < WizardPages.Count)
            {
                previousPage = WizardPages[previousPageIndex];
            }
            CurrentPage = previousPage;
            UpdatePageCommand();
        }
예제 #5
0
        private void ExecuteNextPageCommand()
        {
            IWizardPageVM nextPage = null;

            var currentIndex  = WizardPages.IndexOf(CurrentPage);
            var nextPageIndex = currentIndex + 1;

            if (nextPageIndex < WizardPages.Count)
            {
                nextPage = WizardPages[nextPageIndex];
            }

            CurrentPage = nextPage;

            UpdatePageCommand();
        }
예제 #6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(AvaloniaProperty.UnsetValue);
            }

            var list = value as IEnumerable <IWizardPageVM>;

            var result = new AvaloniaList <WizardPage>();

            foreach (IWizardPageVM wizardPageVM in list)
            {
                IWizardPageVM vm         = wizardPageVM as IWizardPageVM;
                WizardPage    wizardPage = new WizardPage();
                wizardPage.DataContext = vm;
                result.Add(wizardPage);
            }

            return(result);
        }