Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a property at design-time initializer that has a TypeConverter breaks the designer layout. #19

Open
arivoir opened this issue Jun 12, 2020 · 0 comments
Assignees

Comments

@arivoir
Copy link

arivoir commented Jun 12, 2020

I have one WPF5 control named C1PolygonIcon icon that has a property "Points" of the type Point[]

        /// <summary>
        /// Gets the points that describe the shape.
        /// </summary>
        [TypeConverter(typeof(PointArrayTypeConverter))]
        public Point[] Points
        {
            get
            {
                return (Point[])GetValue(PointsProperty);
            }
            set
            {
                SetValue(PointsProperty, value);
            }
        }

In the DefaultInitializer of this class I'm setting this property

    class C1PolygonIconInitializer : DefaultInitializer
    {
        public override void InitializeDefaults(ModelItem icon, EditingContext context)
        {
            base.InitializeDefaults(icon, context);
            icon.Properties["Points"].SetValue("1502.13,0 1502.13,97.586 1658.97,97.586 1354.679,894.543 1160.577,894.543 1160.577,992.129 1615.981,992.129 1615.981,894.543 1459.14,894.543 1763.431,97.586 1957.534,97.586 1957.534,0");
        }
    }

When dropping the control from the toolbox the layout of the designer gets broken, despite the generated code is correct, and after rebuilding the project the designer shows the control correctly.

I'm assuming there is a problem with the TypeConverter. because I've only had the problem with this property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants