wpf Wizard Toolkit ItemsSource binding to a List












3














I am implementing the MVVM pattern and wish to design my interface using the Wizard Control from the WPF ToolKit (Xceed.Wpf.Toolkit).



What I would like to do is bind the Items Source for the Wizard to a List<ViewModelBase> and use a DataTemplate to display it as a page. So far, no Joy. :-(



I have trimmed my code as much as possible but here is the meat of it.



My view XAML:



<xctk:Wizard FinishButtonClosesWindow="True" ItemsSource="{Binding Pages}" />


My Data template:



<DataTemplate DataType="{x:Type vm:ViewModelBase}">
<xctk:WizardPage Title="{Binding DisplayName}" Description="{Binding DisplayDescription}"/>
</DataTemplate>


In the cs files:
the the VM, the property returning the list is defined:



public List<ViewModelBase> Pages


In the app.xaml.cs:



var viewModel = new ViewModels.winMainViewModel();
winMain window = new winMain();

window.DataContext = viewModel;
window.Show();


The error that is thrown is:




System.NotSupportedException was unhandled HResult=-2146233067

Message=Wizard should only contain WizardPages.

Source=Xceed.Wpf.Toolkit




Any help would be greatly appreciated.



TIA,
Ray










share|improve this question





























    3














    I am implementing the MVVM pattern and wish to design my interface using the Wizard Control from the WPF ToolKit (Xceed.Wpf.Toolkit).



    What I would like to do is bind the Items Source for the Wizard to a List<ViewModelBase> and use a DataTemplate to display it as a page. So far, no Joy. :-(



    I have trimmed my code as much as possible but here is the meat of it.



    My view XAML:



    <xctk:Wizard FinishButtonClosesWindow="True" ItemsSource="{Binding Pages}" />


    My Data template:



    <DataTemplate DataType="{x:Type vm:ViewModelBase}">
    <xctk:WizardPage Title="{Binding DisplayName}" Description="{Binding DisplayDescription}"/>
    </DataTemplate>


    In the cs files:
    the the VM, the property returning the list is defined:



    public List<ViewModelBase> Pages


    In the app.xaml.cs:



    var viewModel = new ViewModels.winMainViewModel();
    winMain window = new winMain();

    window.DataContext = viewModel;
    window.Show();


    The error that is thrown is:




    System.NotSupportedException was unhandled HResult=-2146233067

    Message=Wizard should only contain WizardPages.

    Source=Xceed.Wpf.Toolkit




    Any help would be greatly appreciated.



    TIA,
    Ray










    share|improve this question



























      3












      3








      3







      I am implementing the MVVM pattern and wish to design my interface using the Wizard Control from the WPF ToolKit (Xceed.Wpf.Toolkit).



      What I would like to do is bind the Items Source for the Wizard to a List<ViewModelBase> and use a DataTemplate to display it as a page. So far, no Joy. :-(



      I have trimmed my code as much as possible but here is the meat of it.



      My view XAML:



      <xctk:Wizard FinishButtonClosesWindow="True" ItemsSource="{Binding Pages}" />


      My Data template:



      <DataTemplate DataType="{x:Type vm:ViewModelBase}">
      <xctk:WizardPage Title="{Binding DisplayName}" Description="{Binding DisplayDescription}"/>
      </DataTemplate>


      In the cs files:
      the the VM, the property returning the list is defined:



      public List<ViewModelBase> Pages


      In the app.xaml.cs:



      var viewModel = new ViewModels.winMainViewModel();
      winMain window = new winMain();

      window.DataContext = viewModel;
      window.Show();


      The error that is thrown is:




      System.NotSupportedException was unhandled HResult=-2146233067

      Message=Wizard should only contain WizardPages.

      Source=Xceed.Wpf.Toolkit




      Any help would be greatly appreciated.



      TIA,
      Ray










      share|improve this question















      I am implementing the MVVM pattern and wish to design my interface using the Wizard Control from the WPF ToolKit (Xceed.Wpf.Toolkit).



      What I would like to do is bind the Items Source for the Wizard to a List<ViewModelBase> and use a DataTemplate to display it as a page. So far, no Joy. :-(



      I have trimmed my code as much as possible but here is the meat of it.



      My view XAML:



      <xctk:Wizard FinishButtonClosesWindow="True" ItemsSource="{Binding Pages}" />


      My Data template:



      <DataTemplate DataType="{x:Type vm:ViewModelBase}">
      <xctk:WizardPage Title="{Binding DisplayName}" Description="{Binding DisplayDescription}"/>
      </DataTemplate>


      In the cs files:
      the the VM, the property returning the list is defined:



      public List<ViewModelBase> Pages


      In the app.xaml.cs:



      var viewModel = new ViewModels.winMainViewModel();
      winMain window = new winMain();

      window.DataContext = viewModel;
      window.Show();


      The error that is thrown is:




      System.NotSupportedException was unhandled HResult=-2146233067

      Message=Wizard should only contain WizardPages.

      Source=Xceed.Wpf.Toolkit




      Any help would be greatly appreciated.



      TIA,
      Ray







      c# wpf wpftoolkit toolkit xceed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 12 '18 at 21:55









      orhtej2

      1,6402715




      1,6402715










      asked Nov 12 '18 at 21:49









      Ray HastieRay Hastie

      475




      475
























          2 Answers
          2






          active

          oldest

          votes


















          1














          This is apparently not supported as you can see in the source code: https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/Wizard.cs



          I am afraid you can only bind to an IEnumerable<Xceed.Wpf.Toolkit.WizardPage>.






          share|improve this answer































            2














            Thank you for that response.
            Last night I tried playing around with an IConverter class with no luck (yet)



            Due to pending deadlines, I decided to write a simple conversion property.



                public List<WizardPage> wizPages
            {
            get
            {
            List<WizardPage> rtn = new List<WizardPage>();
            foreach (ViewModelBase vmb in Pages)
            {
            rtn.Add(new WizardPage()
            { Title = vmb.DisplayName
            , Description = vmb.DisplayDescription
            , DataContext = vmb
            }); // rtn.Add
            } // foreach (ViewModelBase vmb in Pages)

            return rtn;
            }
            }





            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270610%2fwpf-wizard-toolkit-itemssource-binding-to-a-list%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              1














              This is apparently not supported as you can see in the source code: https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/Wizard.cs



              I am afraid you can only bind to an IEnumerable<Xceed.Wpf.Toolkit.WizardPage>.






              share|improve this answer




























                1














                This is apparently not supported as you can see in the source code: https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/Wizard.cs



                I am afraid you can only bind to an IEnumerable<Xceed.Wpf.Toolkit.WizardPage>.






                share|improve this answer


























                  1












                  1








                  1






                  This is apparently not supported as you can see in the source code: https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/Wizard.cs



                  I am afraid you can only bind to an IEnumerable<Xceed.Wpf.Toolkit.WizardPage>.






                  share|improve this answer














                  This is apparently not supported as you can see in the source code: https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.Toolkit/Wizard/Implementation/Wizard.cs



                  I am afraid you can only bind to an IEnumerable<Xceed.Wpf.Toolkit.WizardPage>.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 13 '18 at 14:39

























                  answered Nov 13 '18 at 9:39









                  mm8mm8

                  81.7k81831




                  81.7k81831

























                      2














                      Thank you for that response.
                      Last night I tried playing around with an IConverter class with no luck (yet)



                      Due to pending deadlines, I decided to write a simple conversion property.



                          public List<WizardPage> wizPages
                      {
                      get
                      {
                      List<WizardPage> rtn = new List<WizardPage>();
                      foreach (ViewModelBase vmb in Pages)
                      {
                      rtn.Add(new WizardPage()
                      { Title = vmb.DisplayName
                      , Description = vmb.DisplayDescription
                      , DataContext = vmb
                      }); // rtn.Add
                      } // foreach (ViewModelBase vmb in Pages)

                      return rtn;
                      }
                      }





                      share|improve this answer


























                        2














                        Thank you for that response.
                        Last night I tried playing around with an IConverter class with no luck (yet)



                        Due to pending deadlines, I decided to write a simple conversion property.



                            public List<WizardPage> wizPages
                        {
                        get
                        {
                        List<WizardPage> rtn = new List<WizardPage>();
                        foreach (ViewModelBase vmb in Pages)
                        {
                        rtn.Add(new WizardPage()
                        { Title = vmb.DisplayName
                        , Description = vmb.DisplayDescription
                        , DataContext = vmb
                        }); // rtn.Add
                        } // foreach (ViewModelBase vmb in Pages)

                        return rtn;
                        }
                        }





                        share|improve this answer
























                          2












                          2








                          2






                          Thank you for that response.
                          Last night I tried playing around with an IConverter class with no luck (yet)



                          Due to pending deadlines, I decided to write a simple conversion property.



                              public List<WizardPage> wizPages
                          {
                          get
                          {
                          List<WizardPage> rtn = new List<WizardPage>();
                          foreach (ViewModelBase vmb in Pages)
                          {
                          rtn.Add(new WizardPage()
                          { Title = vmb.DisplayName
                          , Description = vmb.DisplayDescription
                          , DataContext = vmb
                          }); // rtn.Add
                          } // foreach (ViewModelBase vmb in Pages)

                          return rtn;
                          }
                          }





                          share|improve this answer












                          Thank you for that response.
                          Last night I tried playing around with an IConverter class with no luck (yet)



                          Due to pending deadlines, I decided to write a simple conversion property.



                              public List<WizardPage> wizPages
                          {
                          get
                          {
                          List<WizardPage> rtn = new List<WizardPage>();
                          foreach (ViewModelBase vmb in Pages)
                          {
                          rtn.Add(new WizardPage()
                          { Title = vmb.DisplayName
                          , Description = vmb.DisplayDescription
                          , DataContext = vmb
                          }); // rtn.Add
                          } // foreach (ViewModelBase vmb in Pages)

                          return rtn;
                          }
                          }






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 13 '18 at 14:53









                          Ray HastieRay Hastie

                          475




                          475






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53270610%2fwpf-wizard-toolkit-itemssource-binding-to-a-list%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              這個網誌中的熱門文章

                              Tangent Lines Diagram Along Smooth Curve

                              Yusuf al-Mu'taman ibn Hud

                              Zucchini