How to use margin as property of WPF usercontrol?
public Double pCusSPAge
{
get
{
return btnCusSPAge.Margin.Left;
}
set
{
btnCusSPAge.Margin = new Thickness(value);
if (PropertyChanged 开发者_如何学Python!= null)
PropertyChanged(this, new PropertyChangedEventArgs("pCusSPAge"));
}
}
UserControl have a Margin Property and you use it like this...
to set it:
Thickness newMargin = new Thickness(1, 1, 1, 1); //just an example
UserControl.Margin = newMargin;
to get it:
Thickness newMargin = new Thickness();
newMargin = UserControl.Margin;
Is that what you wanted to know?
精彩评论