Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Margin from C# code

I want to set the margins of different controls using C# code-behind (I know how to do it in XAML markup).

I need it for controls like rectangle or buttons.

like image 445
akshaykumar6 Avatar asked Dec 27 '22 06:12

akshaykumar6


1 Answers

myControl.Margin = new Thickness(left, top, right, bottom);

or

myControl.Margin = new Thickness(allSideMarginSize);

should do it.

like image 75
ZombieSheep Avatar answered Jan 07 '23 04:01

ZombieSheep