Change margin programmatically in WPF / C#
test.Margin = new Thickness(0, -5, 0, 0);
Alignment, Margins and Padding Overview (MSDN)
FrameworkElement.Margin (MSDN)
test.Margin = new Thickness(0, 0, 0, 0);
test.Margin = new Thickness(-5);
test.Margin = new Thickness(0, -5, 0, 0);
Alignment, Margins and Padding Overview (MSDN)
FrameworkElement.Margin (MSDN)
test.Margin = new Thickness(0, 0, 0, 0);
test.Margin = new Thickness(-5);