views:

97

answers:

1

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 != null)
                PropertyChanged(this, new PropertyChangedEventArgs("pCusSPAge"));
        }
    }
+1  A: 

Hi,

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?

sofri