Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. D'ooh

D'ooh

Scheduled Pinned Locked Moved The Lounge
winformscom
11 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marco Bertschi
    wrote on last edited by
    #1

    Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

    WizardViewModel model = new WizardViewModel();
    model.WizardTitle = "Test";
    model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

            WizardStepViewModel stepmodel = new WizardStepViewModel();
            stepmodel.Name = "Willkommen";
            stepmodel.Content = new Testdata.WelcomeScreen();
    
            WizardStepViewModel stepmodel2 = new WizardStepViewModel();
            stepmodel.Name = "Wizard-Zeug";
            stepmodel.Content = new Testdata.TestUserControl2();
    
            WizardStepViewModel stepmodel3 = new WizardStepViewModel();
            stepmodel.Name = "Zusammenfassung";
            stepmodel.Content = new Testdata.EndUserControl();
    
            model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
    
            WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
            this.MainGrid.Children.Add(ctrl);
    

    You see why, don't ya. :doh: :doh:

    "A property doesn't have to be a Property to be a property." - PIEBALDConsult

    P S M B W 5 Replies Last reply
    0
    • M Marco Bertschi

      Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

      WizardViewModel model = new WizardViewModel();
      model.WizardTitle = "Test";
      model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

              WizardStepViewModel stepmodel = new WizardStepViewModel();
              stepmodel.Name = "Willkommen";
              stepmodel.Content = new Testdata.WelcomeScreen();
      
              WizardStepViewModel stepmodel2 = new WizardStepViewModel();
              stepmodel.Name = "Wizard-Zeug";
              stepmodel.Content = new Testdata.TestUserControl2();
      
              WizardStepViewModel stepmodel3 = new WizardStepViewModel();
              stepmodel.Name = "Zusammenfassung";
              stepmodel.Content = new Testdata.EndUserControl();
      
              model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
      
              WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
              this.MainGrid.Children.Add(ctrl);
      

      You see why, don't ya. :doh: :doh:

      "A property doesn't have to be a Property to be a property." - PIEBALDConsult

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      D'oh indeed. But surely it's just Zusammenfassung that's showing. It's to avoid this type of issue I would normally do something like this:

      private WizardStepViewModel GetModel<TModel>(string name) where T : class, new()
      {
      return new WizardStepViewModel { Name = name, Content = new TModel() };
      }

      This space for rent

      1 Reply Last reply
      0
      • M Marco Bertschi

        Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

        WizardViewModel model = new WizardViewModel();
        model.WizardTitle = "Test";
        model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

                WizardStepViewModel stepmodel = new WizardStepViewModel();
                stepmodel.Name = "Willkommen";
                stepmodel.Content = new Testdata.WelcomeScreen();
        
                WizardStepViewModel stepmodel2 = new WizardStepViewModel();
                stepmodel.Name = "Wizard-Zeug";
                stepmodel.Content = new Testdata.TestUserControl2();
        
                WizardStepViewModel stepmodel3 = new WizardStepViewModel();
                stepmodel.Name = "Zusammenfassung";
                stepmodel.Content = new Testdata.EndUserControl();
        
                model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
        
                WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
                this.MainGrid.Children.Add(ctrl);
        

        You see why, don't ya. :doh: :doh:

        "A property doesn't have to be a Property to be a property." - PIEBALDConsult

        S Offline
        S Offline
        Sascha Lefevre
        wrote on last edited by
        #3

        Something like this surely happened to anyone at some point ;) But I have a suggestion for you:

        WizardStepViewModel stepmodel = new WizardStepViewModel()
        {
        Name = "Willkommen",
        Content = new Testdata.WelcomeScreen()
        };

        If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

        M 1 Reply Last reply
        0
        • M Marco Bertschi

          Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

          WizardViewModel model = new WizardViewModel();
          model.WizardTitle = "Test";
          model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

                  WizardStepViewModel stepmodel = new WizardStepViewModel();
                  stepmodel.Name = "Willkommen";
                  stepmodel.Content = new Testdata.WelcomeScreen();
          
                  WizardStepViewModel stepmodel2 = new WizardStepViewModel();
                  stepmodel.Name = "Wizard-Zeug";
                  stepmodel.Content = new Testdata.TestUserControl2();
          
                  WizardStepViewModel stepmodel3 = new WizardStepViewModel();
                  stepmodel.Name = "Zusammenfassung";
                  stepmodel.Content = new Testdata.EndUserControl();
          
                  model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
          
                  WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
                  this.MainGrid.Children.Add(ctrl);
          

          You see why, don't ya. :doh: :doh:

          "A property doesn't have to be a Property to be a property." - PIEBALDConsult

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #4

          1, 2, 3, oops. I must say though, it occurs to me that sometimes the MVVM pattern is a bit, well, over the top. When something like (pseudo-codish):

          Items items = new Items[] {new Item("foo", control), ...etc...};
          MainGrid.Children.Add(items);

          where you override Item.ToString() with Item.Name ? BTW, I loathe this. syntax. It's so Visual Basic, I, Me, Me, Mine ;) Marc

          Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

          G M 2 Replies Last reply
          0
          • M Marc Clifton

            1, 2, 3, oops. I must say though, it occurs to me that sometimes the MVVM pattern is a bit, well, over the top. When something like (pseudo-codish):

            Items items = new Items[] {new Item("foo", control), ...etc...};
            MainGrid.Children.Add(items);

            where you override Item.ToString() with Item.Name ? BTW, I loathe this. syntax. It's so Visual Basic, I, Me, Me, Mine ;) Marc

            Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

            G Offline
            G Offline
            glennPattonWork3
            wrote on last edited by
            #5

            Quote:

            syntax. It's so Visual Basic, I, Me, Me, Mine Wink | ;)

            Visual...wait burn it with fire! :omg:

            1 Reply Last reply
            0
            • M Marco Bertschi

              Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

              WizardViewModel model = new WizardViewModel();
              model.WizardTitle = "Test";
              model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

                      WizardStepViewModel stepmodel = new WizardStepViewModel();
                      stepmodel.Name = "Willkommen";
                      stepmodel.Content = new Testdata.WelcomeScreen();
              
                      WizardStepViewModel stepmodel2 = new WizardStepViewModel();
                      stepmodel.Name = "Wizard-Zeug";
                      stepmodel.Content = new Testdata.TestUserControl2();
              
                      WizardStepViewModel stepmodel3 = new WizardStepViewModel();
                      stepmodel.Name = "Zusammenfassung";
                      stepmodel.Content = new Testdata.EndUserControl();
              
                      model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
              
                      WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
                      this.MainGrid.Children.Add(ctrl);
              

              You see why, don't ya. :doh: :doh:

              "A property doesn't have to be a Property to be a property." - PIEBALDConsult

              B Offline
              B Offline
              BillWoodruff
              wrote on last edited by
              #6

              WizardViewModel model = new WizardViewModel(
              WizardTitle: "Test",
              WizardDescription: "Ein schlecht gestylter Beispiel-Wizard.",
              new WizardStepViewModel("Willkommen", new Testdata.WelcomeScreen()),
              new WizardStepViewModel("Wizard-Zeug", new Testdata.TestUserControl2()),
              new WizardStepViewModel("Zusammenfassung", new Testdata.EndUserControl()));

              Assuming:

              public class WizardViewModel(string title, string description, params WizardStepViewModel[] stepviews) { ... }

              I note that you, as author, made the same choice that L. Frank Baum made in "Wizard of Oz:" the WizardControl makes a dramatic appearance from nowhere at the end of the novel. And, nice touch with the suggestion of recursion: WizardControl.View.WizardControl : I assume that's the way things go down in MVVM-land. But, don't let this (deliberately ... perceived by you as playful, I hope) capricious intrusion distract you from the enjoying the current flavour of your omnipotence ... after all, isn't it that taste that makes the drudgery ... of having to behave like robots to get other robots to (kind of) half-do our bidding at the expense of art and grace, and with the cost of our wallowing in endless minutiae ... worthwhile ? :)

              «The truth is a snare: you cannot have it, without being caught. You cannot have the truth in such a way that you catch it, but only in such a way that it catches you.» Soren Kierkegaard

              1 Reply Last reply
              0
              • M Marc Clifton

                1, 2, 3, oops. I must say though, it occurs to me that sometimes the MVVM pattern is a bit, well, over the top. When something like (pseudo-codish):

                Items items = new Items[] {new Item("foo", control), ...etc...};
                MainGrid.Children.Add(items);

                where you override Item.ToString() with Item.Name ? BTW, I loathe this. syntax. It's so Visual Basic, I, Me, Me, Mine ;) Marc

                Imperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!

                M Offline
                M Offline
                Marco Bertschi
                wrote on last edited by
                #7

                Marc Clifton wrote:

                BTW, I loathe this. syntax. It's so Visual Basic, I, Me, Me, Mine ;)

                I wrote the code on my home PC (which VS Community 2015). The IntelliSense only seems to work if I put this, and I did not really care since it is test code only. (Not test as in Unit-Test, but as in "Test I only want to do to see if it works).

                "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                1 Reply Last reply
                0
                • S Sascha Lefevre

                  Something like this surely happened to anyone at some point ;) But I have a suggestion for you:

                  WizardStepViewModel stepmodel = new WizardStepViewModel()
                  {
                  Name = "Willkommen",
                  Content = new Testdata.WelcomeScreen()
                  };

                  If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

                  M Offline
                  M Offline
                  Marco Bertschi
                  wrote on last edited by
                  #8

                  I usually use this, but since it was just write once, run once test code I frankly didn't care at the moment of writing.

                  "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                  P 1 Reply Last reply
                  0
                  • M Marco Bertschi

                    I usually use this, but since it was just write once, run once test code I frankly didn't care at the moment of writing.

                    "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    Bet you care now ;)

                    This space for rent

                    M 1 Reply Last reply
                    0
                    • P Pete OHanlon

                      Bet you care now ;)

                      This space for rent

                      M Offline
                      M Offline
                      Marco Bertschi
                      wrote on last edited by
                      #10

                      Guess so. Usually, at work, R# handles stuff like that for me. Unfortunately said code was written at home, with VS Community 15, and no R#. Software makes us dumb.

                      "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                      1 Reply Last reply
                      0
                      • M Marco Bertschi

                        Started a pet project last weekend. I want to have a wizard control which just sucks up user controls and displays them in a given order with a given title in the side bar. I know something like that alread does exist on CP, but I 1) Want to make one on my own. My time, don't tell me what to do with it :laugh: 2) I'm not sure how good the existing one supports page validation. Anyways, I was debugging the first (very raw) build, and for some reason just the first item in the TOC was showing a title:

                        WizardViewModel model = new WizardViewModel();
                        model.WizardTitle = "Test";
                        model.WizardDescription = "Ein schlecht gestylter Beispiel-Wizard.";

                                WizardStepViewModel stepmodel = new WizardStepViewModel();
                                stepmodel.Name = "Willkommen";
                                stepmodel.Content = new Testdata.WelcomeScreen();
                        
                                WizardStepViewModel stepmodel2 = new WizardStepViewModel();
                                stepmodel.Name = "Wizard-Zeug";
                                stepmodel.Content = new Testdata.TestUserControl2();
                        
                                WizardStepViewModel stepmodel3 = new WizardStepViewModel();
                                stepmodel.Name = "Zusammenfassung";
                                stepmodel.Content = new Testdata.EndUserControl();
                        
                                model.WizardSteps = new List<WizardStepViewModel>() { stepmodel, stepmodel2, stepmodel3 };
                        
                                WizardControl.View.WizardControl ctrl = new View.WizardControl(model);
                                this.MainGrid.Children.Add(ctrl);
                        

                        You see why, don't ya. :doh: :doh:

                        "A property doesn't have to be a Property to be a property." - PIEBALDConsult

                        W Offline
                        W Offline
                        wizardzz
                        wrote on last edited by
                        #11

                        You rang???

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups