VisualHint's blog

Solving all the issues of the DateTimePicker inside the DataGridView

Some days ago I came across a blog showing the trials and tribulations of a developer trying to display and use the standard DateTimePicker in the DataGridView. This story is really typical of all the considerable efforts one have to make in order to get a semi-viable solution. So far I was not even considering touching the DataGridView. It was an unknown component to me and I was not aware of its extensibility to enable custom editors to be used in a cell. After readind this article I jumped [...]

How to setup a truly dynamic combobox in the PropertyGrid?

SPG offers some great ways to build dynamic properties. But often this is a mix of declarative code and dynamic calls to the SPG API to alter the content or the behavior of the grid. However in some cases a complete dynamic solution is needed. For example, some classes may be generated by external tools and it’s impossible or not desired to decorate their properties with attributes. In other contexts, enumerations are not welcome because their content is too ... hardcoded. This article proposes [...]

How to set a null value to a DateTimePicker without any compromise?

Just to make it clear that this is the first concern about the MS DateTimePicker, here is a list of famous links: Yet another DateTime…Slicker? Yet another nullable DateTimePicker control Extended DateTimePicker Nullable DateTimePicker These articles all try various tricks to create a nullable DateTimePicker. Unfortunately, while the intentions are good, it does always create secondary issues (look into the comments). SFPE will naturally support null values but from a user point of view the [...]

How to format a number with a specific CultureInfo/NumberFormatInfo in the PropertyGrid ?

“How to format a number in the PropertyGrid” is a question that I’m often asked. The following answer is valid for the MS PropertyGrid and for Smart PropertyGrid.Net. Therefore it is not in the SPG documentation. The following explanation will be given for a Double number. You can easily apply it to a Single or a Decimal. If your target instance has a Double property, it uses by default the DoubleConverter TypeConverter. Unfortunately (for the present need) this converter uses the “R” format [...]

The ten deceptions of the DateTimePicker

If you are here reading these lines it’s because you have something against the .Net DateTimePicker. And you’re not alone since, if you do a search in the newsgroups, the same questions keep coming: “how do I set the background color of the DTP?”, or “it does not accept a null value and my DateTime column in my database has some empty cells”. CodeProject and other similar developer communities give you a lot of pseudo solutions to solve one or two issues of the control… when they don’t create [...]

The perfect DateTimePicker? Not only!

It is well known that a good product is one that provides a solution to your own problem, and as a result would meet the needs of a wider audience. Some time ago I discovered a problem in SPG.Net. I couldn’t make a true DateTimePicker inplace control achieving the level of quality of the overall product. The win32 control from Microsoft has so many issues and inconsistencies that it was a nightmare trying to work around them. Finally I decided to remove this inplace control from SPG and [...]

A new home for VisualHint

VisualHint has reached another milestone. Today, I’m launching my new web site that offers the GUI components that I design. The redesign was not out of boredom, but simply the result of a need to support more than one product. The previous site had been designed around a main product (Smart PropertyGrid) and the accompanying news section and I had no idea how to add another product which would have the same importance. Therefore, it was time for a redesign. I took Xara Xtreme Pro, a very nice [...]

Value validation in great form

So far, value validation in SPG was simple and clean: no annoying popup but also the obligation to see the previous value automatically restored. For the next release, value validation is being reworked. It will still offer the existing behavior but also a mode called KeepFocus. Under this new mode, the focus stays on the faulty value until the user types a valid value (this is what happens in the Microsoft PropertyGrid but unfortunately spoiled with the modal popup). Inside a new validation [...]

PropertyValueChanged for collections bug fix

I was not aware of this bug in the Microsoft PropertyGrid until a customer told me it was doing the same thing in Smart PropertyGrid. This is interesting enough to add a post here about it. The issue is that PropertyValueChanged is not fired for certain collections. It works with an array but doesn’t for a List<> for instance. The reason is that the UITypeEditor.EditValue(...) method returns the reference on the original collection even if its content has been modified. I looked in Reflector [...]

A website for PropertyGrid resources

I launched today a new web site, minimalist in page count, intended to .Net developers who use the Microsoft PropertyGrid (and secondarily Smart PropertyGrid.Net since it understands all the framework classes related to Type discovery). Because this is sometimes difficult to get the right information for developers who start using this complex component, it seems it was essential to have a well known page referencing all famous and less famous articles, forum posts and other various materials. [...]