Binding only part of the margin property of WPF control

后端 未结 7 1385
忘掉有多难
忘掉有多难 2020-12-01 03:49

I have this:

...

I want to bind only the \"Top\" part of the TabContr

7条回答
  •  感情败类
    2020-12-01 03:50

    Actually Margin property of a control is of Thickness Type. So we can bind it to Property if type Thickness.

     public Thickness LeftMargin { get; set; }
    

    and You can set a part of a Thickness object too. Like -

     LeftMargin = new Thickness(20,0,0,0);
    

    and in Xaml we can bind this property directly to margin property of any element..like this..

     
    

提交回复
热议问题