locked
InvalidCastException when trying to cast DesignTime data in a converter RRS feed

  • Question

  • I have created some design time data in Expression Blend 4.0 for my Silverlight 3.0 project. I created it using the "Create Sample Data From Class.." option in the Data tab of Blend.

    One of the properties on the sample data is a custom class that we convert to a set of Point on a Polygon using an IValueConverter. The code in the COnverter does this

    var planPoints = (List<PlanPoint>)value;
    var points = new PointCollection();
    planPoints.ForEach(pp => points.Add(new Point(pp.X, pp.Y)));
    return points;

    The trouble is the value argument is not being passed in with the type we would expect. We are expecting List<CompanyName.Data.PlanPoint> but instead we are getting List<_.di1.CompanyName.Data.PlanPoint>.

    Why is Blending using what seems to be a proxy type and how can we stop this?

    TIA

    Pat Long


    Pat Long munkiisoft blog
    Tuesday, October 12, 2010 8:43 AM

All replies