I believe you might be using Material Design In XAML. Make sure to check out the demo project. It contains all the answers to common control usage.
OPTION ONE.
You would usually use the "ItemsControl" to load objects into view dynamically. The items control is linked to a items source in your back-end view model. The source should be of type ObservableCollection. When ever you feed items to this source, the ItemsControl will update and insert based on the template it's provided.
Below is a basic short example.
xaml
<ItemsControl ItemsSource="{Binding ItemsToLoad}" Grid.IsSharedSizeScope="True" Margin="12 0 12 0">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button>Hi</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
I'm assuming you have a good understanding of bindings, so I wont be posting all the back end code.
OPTION TWO
programmatically
Seeing as you mentioned that you want to do it programmatically, you could also just do this:
Step 1 : Create a grid and set a layout for you to work with.
<Grid x:Name="grid_Main">
<Grid.ColumnsDefinition>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnsDefinition>
<Grid.RowDefinition>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinition>
</Grid>
Step 2: Code behind.
private void AddControlToGrid()
{
Button button = new Button();
grid_Main.Children.Add(button );
Grid.SetRow(button , 1); // 1 is row index
Grid.SetColumn(button , 0);// 0 is column index
}
Just a Note of the material design usage. You need to reference the lib before you can use it in your view.
Like this :
Add this to your application resources.
<Application x:Class="demo_app.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:demo_app">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Add this ref to any view you need to use a material design control on.
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
You can then use material design controls like this.
<materialDesign:Card Width="200">
<Grid>
<!--Content-->
</Grid>
</materialDesign:Card>