Hello.

I am Paul Kinlan.

A Developer Advocate for Chrome and the Open Web at Google.

I love the web. The web should allow anyone to access any experience that they need without the need for native install or content walled garden.

Assigining a TypeConverter to a class you don't own

Paul Kinlan

In this post, I describe a solution to a problem I encountered while working with XNA Beta1 and Vector2 structs. Because Vector2 didn't have an associated TypeConverter, the designer lacked support. Applying a TypeConverter to the property worked in the designer, but Visual Studio 2005 ignored it during serialization, resorting to resource files, which was messy. My workaround involves dynamically adding a TypeConverter to the Vector2 type itself using TypeDescriptor.AddAttributes, which is invoked during the class's construction. By registering the Vector2Converter with the Vector2 type early on, both the designer and code serialization work harmoniously.

Read More

XNA Vector2 Type Converter

Paul Kinlan

I was developing a component in XNA and needed a way to edit Vector2 properties directly within the Game Designer. Since Vector2 is a struct and doesn't inherently support this, I created a custom TypeConverter. The provided code allows you to modify Vector2 values in the designer using comma notation (e.g., 50, 100). Feel free to adapt it for other types like Vector3.

Read More