Loading WPF User Control at runtime
02-Jun-1414 Leave a comment
Need to place the user control in a control that accepts content. My current favourite is a “ContentControl”.
Me.ContentCanvas.Content = userControlValue
Me.ContentCanvas.Content = Nothing
Some other controls require Add.
Beware that a StackPanel will expand to fit all content, so if you put a DataGrid and possibly a ListBox in there, there will be no scroll bar.