D'ooh
-
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
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
-
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
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
-
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
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()
withItem.Name
? BTW, I loathethis.
syntax. It's so Visual Basic, I,Me, Me,
Mine ;) MarcImperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
-
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()
withItem.Name
? BTW, I loathethis.
syntax. It's so Visual Basic, I,Me, Me,
Mine ;) MarcImperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
Quote:
syntax. It's so Visual Basic, I, Me, Me, Mine Wink | ;)
Visual...wait burn it with fire! :omg:
-
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
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, 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()
withItem.Name
? BTW, I loathethis.
syntax. It's so Visual Basic, I,Me, Me,
Mine ;) MarcImperative to Functional Programming Succinctly Contributors Wanted for Higher Order Programming Project!
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
-
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
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
-
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
Bet you care now ;)
This space for rent
-
Bet you care now ;)
This space for rent
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
-
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