본문 바로가기
WPF

WPF 동적으로 Margin 변경

by leo21c 2021. 6. 7.
SMALL

버튼이나 Grid 등의 Margin을 동적으로 변경하는 방법

btn.Margin = new System.Windows.Thickness{ Left = 10 };

또는 아래와 같이

btn.Margin = new System.Windows.Thickness{ Left = 10, Top = 0, Right = 10, Bottom = 0 };

https://docs.microsoft.com/ko-kr/dotnet/desktop/wpf/advanced/how-to-set-margins-of-elements-and-controls?view=netframeworkdesktop-4.8 

 

 

LIST