开发者

How to use margin as property of WPF usercontrol?

开发者 https://www.devze.com 2023-01-04 02:25 出处:网络
How to use margin as property of WPF usercontrol? public Double pCusSPAge { get { return btnCusSPAge.Margin.Left;

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消