簡體   English   中英

如何使用邊距作為WPF用戶控件的屬性?

[英]How to use margin as property of WPF usercontrol?

如何使用邊距作為WPF用戶控件的屬性?

    public Double pCusSPAge
    {
        get
        {
            return btnCusSPAge.Margin.Left;
        }
        set
        {
            btnCusSPAge.Margin = new Thickness(value);
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs("pCusSPAge"));
        }
    }

UserControl具有保證金屬性,您可以像這樣使用它...

設置它:

        Thickness newMargin = new Thickness(1, 1, 1, 1); //just an example
        UserControl.Margin = newMargin;

為拿到它,為實現它:

        Thickness newMargin = new Thickness(); 
        newMargin = UserControl.Margin;

那是你想知道的嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM