你好这是我的代码:
public class Class1 : FrameworkElement
{
protected override void OnRender(DrawingContext drawingContext)
{
base.OnRender(drawingContext);
var testOk = this.ActualWidth;
var testNotOk = this.GetValue(ActualWidthProperty);
}
}
TestNotOk 始终为零,TestOk 具有正确的值。为什么会这样?