public MainViewModel(IMatterListLoader matterListLoader) { this.matterListLoader = matterListLoader; if (matterListLoader != null && matterListLoader.Properties != null) { foreach (var prop in matterListLoader.Properties) { if (typeof(prop.Value) == typeof(DateTime)) { // Draw DateTime picker for datetime value this.placeHolderPanelForParams.Add(new DateTimePicker() { Name = prop.Key }); } else { // Draw textbox for everything else this.placeHolderPanelForParams.Add(new TextBox() { Name = prop.Key }); // You can also add validations to the input here (E.g. Dont allow negative numbers of prop is unsigned) // ... } } } }
public MainViewModel(IMatterListLoader matterListLoader) { var panel = matterListLoader.Draw(); if (panel != null) { // Your MainViewModel should have a dummy empty panel called "placeHolderPanelForChildPanel" var parent = this.placeHolderPanelForChildPanel.Parent; parent.Children.Remove(this.placeHolderPanelForChildPanel); // Remove the dummy panel parent.Children.Add(panel); // Replace with new panel } }