如何使用margin作为WPF usercontrol的属性?
public Double pCusSPAge
{
get
{
return btnCusSPAge.Margin.Left;
}
set
{
btnCusSPAge.Margin = new Thickness(value);
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("pCusSPAge"));
}
}
答案 0 :(得分:1)
UserControl有一个Margin Property,你就像这样使用它......
设置它:
Thickness newMargin = new Thickness(1, 1, 1, 1); //just an example
UserControl.Margin = newMargin;
得到它:
Thickness newMargin = new Thickness();
newMargin = UserControl.Margin;
那是你想知道的吗?