LOGIN    REGISTER    YOUR CART

homepage
VisualHint's blog
Apr14

Properties and categories sorting

This is a concern often seen in forums or newsgroups. With the Microsoft PropertyGrid, sorting the properties means having to derive from ICustomTypeDescriptor or TypeDescriptionProvider to return the properties in a specific order. Sorting the categories is simply impossible. I think I have to remedy this problem.

First, don't forget the first mode of operation of SPG: in this mode you can dynamically add and remove categories and properties, so by doing that you control the order.

In the more traditionnal way (reflection), we need something very easy for the developer. I was thinking to 2 possibilities. Let me know what you think about it:

  • Use a new attribute to decorate a property:

    [Category("Personal")]
    [PropertyRank(1)]
    public int MyData { set; get; }
    

    This new tag, "PropertyRank", could be used for categories and properties.

  • Give access to the collection of sibling child properties/categories for a node and let the user reorder them. It could give something like this:

    PropertyEnumerator categoryEnum = propGrid.FindProperty("Personal");
    PropertyEnumerator children = MySort(categoryEnum.Property.Children);
    propGrid.Reorder(children);
    

Of course the usual way with ICustomTypeDescriptor must continue to be available.

Apr12

Appearance customization

Here is the first post of the set I promised previously:

As you all know, the Microsoft PropertyGrid comes in only one flavour, the one I call the DotNet look. It is neat and simple, no point on that. It was even a reference for me when I began coding the version for MFC. But I realized that people wanted more. Some advanced GUI have their own theme and the control should mimic it. In SPG, this is easy. You will be able to choose between some built-in "drawing managers" and you will eventually develop your own one. I did three right now, but if you have a theme that you would like to see in the base package, just let me know. Here is a theme that is used in Sony DVD Architect:

PropertyGridTheme

Then come all the small details that make the whole difference at runtime:

PropertyGrid customizations

By looking at this sample shot, here is what you can do (this list is non exhaustive and may be changed in the future):

  • Change the color of a property/category label.
  • Change the color of a property value.
  • Change the font of a property/category label.
  • Change the font of a property value.
  • Add your own drawings in the property/category label area.
  • Add your own drawings in the property value area.
  • Assign an icon to a property/category label.

You understand that you can modify every aspect of the control. If you want to show an animated cursor, apply a background effect, and so on ... those are all the things that you can implement.

Apr06

MaskedTextBox

This is just a short post to say that I have many requests to include the MaskedTextBox as a way to edit properties. I confirm here that it will be available in SPG.

Update on April 7: This is done and here is a screenshot.

MaskedTextBox
Mar31

First insight

I will in a short time post some articles about specific features of SPG.NET. In the meantime you can already read a list of existing features for the MFC version of the library. Here are the topics I will discuss. They will come with screenshots:

  • Overall look customization: modifying the overall look of the grid is already described on the VisualHint web site. But I want to recall it here because this is one point that can make your grid really stand out in your product and this is something simply impossible in the standard PropertyGrid.
  • Auto-discovery: SPG has its own way to use reflection to discover the inner properties of an object instance. First it mimics what the standard PropertyGrid does so that you get what you are used to. And additionnaly you can customize it to show what you really want to show and how you want to show it. An example would be a Pen displayed only as one row, showing a visual aspect of the pen, with only one child property showing the pen width whose content could be changed with a slider or an updown arrow.
  • Multiple values in a row: Here is really a new concept. Typically a row in the grid is linked to only one data. Now it will be possible to link with any number of data, making possible to represent for example a number (changed with a textbox) and its unit (changed with a listbox).
  • New attributes: Some new attributes are defined, and many more will be added later, to be able to customize a property without having to write a ton of code.
Mar26

What can you expect?

You are discovering this web site and of course you are wondering what to expect. What will emerge from all this talk. Let's put it as a shopping list:

  • A successful and proven design coming from Smart PropertyGrid for MFC.
  • Plenty of features, some that will make the control work like the existing .NET PropertyGrid, and other new exciting ones that will fill in all its shortcomings, lacks and drawbacks.
  • A fast evolving product, based on your needs and criticisms.
  • A top notch support. Your problem is mine and I won't give up until it's solved, even if your subscription is over.
  • You can get the sources.

This is my goal. Don't hesitate to tell me if I unfortunately diverge from it.

Some questions? Please use the comments so that everybody can watch. You must first register to do that. And by doing so you will also subscribe to a low traffic announcements mailing-list.

Mar23

This was an evidence...

... I had to blog to show any interested .NET developers that a new type of PropertyGrid is coming. What better tool than a blog could do that? Anyway, I thought it was easy, but when english is not your natural language and when you face a blank window, writing even the most insipid spiel is not obvious.

So just let me introduce myself: my name is Nicolas Cadilhac. I live in Montreal, Canada. I'm creating my own company because I want to dedicate the right amount of time to the products I create. And moreover, people from the .NET side are constantly asking me if I will one day or another port this great custom control to their world. So today, the answer is yes.

There is not real meat here yet, but stay tuned. It will come quicker than you think. The web site also has all the basics to make it work. I will add bit by bit all needed features. If you see something wrong in your browser, thanks to let me know.

And please, for pity's sake, pardon my english and contact me to correct any big mistake or strange turn of phrase you may see.