myControl.Margin = new Thickness(left, top, right, bottom); 或者myControl.Margin = new Thickness(allSideMarginSize); 应该这样做。