0

Calling overridable method in the constructor ?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

SagarDabas wrote at 2013-03-31 08:05:

I am doing little changes in QuadVisual3D by overriding Tessellate. AreaChart is the subclass of QuadVisual3D.
public static readonly DependencyProperty PointsProperty = 
DependencyProperty.Register("PointsList", typeof(Point3DCollection), 
typeof(AreaChart), new UIPropertyMetadata(null,
 GeometryChanged));


 public Point3DCollection PointsList
    {
        get
        { return (Point3DCollection)this.GetValue(PointsProperty); }

        set
        { this.SetValue(PointsProperty, value); }
    }
I am not able to instantiate PointsList property using this code :
<local:AreaChart PointsList="0,0,8 0,-10,11" Extrusion="2" />
I am getting Count as 0 (or null Exception if I don't give a default value in the PropertyMetadata).

It looks like Tessellate method is invoked in the constructor of MeshElement3D class.
Can you please suggest what should I do ?

SagarDabas wrote at 2013-03-31 09:35:

Ok, Got it. I used a temporary list to do the changes rather than directly modifying the property.
And initialized property with default values which is changed when the AreaChart constructor is invoked or it's fields are initialized.

Thanks for the awesome library.