What is the difference between Width and ActualWidth in WPF?

前端 未结 7 687
不知归路
不知归路 2020-11-27 05:23

I am currently working with Panels in WPF, and I noticed that as regards the Width and Height properties, there are also two other pro

相关标签:
7条回答
  • 2020-11-27 06:18

    ActualWidth is set by the rendering system, and may be different depending on the widths of other elements and overall size constraints. As a result, it can not be changed. Width is a property that can be changed, and should be used to increase or decrease the width of the element.

    From MSDN:

    This property is a calculated value based on other width inputs, and the layout system. The value is set by the layout system itself, based on an actual rendering pass, and may therefore lag slightly behind the set value of properties such as Width that are the basis of the input change.

    0 讨论(0)
提交回复
热议问题