Featured Common Controls

I would like to share my little library, which make my life easier when I create an user interface. At all, there are the same standard components, but with smart tags. They adapt on general and private fields. After starting installer and successful end of its work, you can find a new toolbar in the studio.

The library determines to GAC, creates a new toolbar in Visual Studio, and adds to a dialog box «Add reference…». You can read how to do it on your own in the one of my previous articles.

You can load the installer or a source code for these components and make a light setup for personally you or add your components. Don’t be shy to give suggestions which other elements of the UX can make better, what often uses and can be useful.

Source code and Installer

Next I will describe in short components which a library includes.

Continue reading

Custom controls

What for?

During everyday work I create a dozen of custom control.  Formally, every “User Control” is a custom control. I create a specific layout from standard controls and use it in a program. I don’t think about them as about “real custom control”, because they are useful only for me in my very particular application. In the most common cases I don’t reuse them at all out of application scope. But from time to time I discover that some of them are good for common usage.

Sometimes I find good examples of controls from other systems or chargeable control kit. If one man make something, other one could make it also. =) By the way it’s a great challenge.

When I get know a smart tag closer, I’d decided that some of controls can be extended. It’s just like using extension methods to create DSL, helping classes and so on to write faster and easier. The same story with controls.

So there are several reasons why a custom control appears:

  • Occasionally – as a result of everyday work;
  • Extracted same parts from occasional controls;
  • Planned as a new control from the very beginning;
  • As an extension of exists control.

Continue reading

How to install custom controls

After creating some stuff, you’d like to use it from time to time in a different project. How to install it on VS Toolbar, add to “Add reference…” dialog and how to avoid underwater rocks – all this will be uncovered on next few pages.

Prepare assembly

When you have project with tuned custom controls and you feel fine how they works and looks like – you probably automate install actions. What you have to do to install controls:

  1. Add sign to assembly;
  2. Install assembly to GAC;
  3. Add to Visual Studio “Add reference…” dialog;
  4. Add to Visual Studio Toolbar.

I’m going to show you how to do almost all of this numbers programmatically in code snippets. Assume that control’s library called myCustomControl.dll. It’s up to you how to combine them for nice looking application. ;)

Continue reading

Smart tag – Single Binding

Intro

I’d like to continue describing how to create a smart tag. Previously I wrote what is smart tag and how to create it. In this post I’d like to tell how to create binding for the single field.

I assume that you have already created a custom user control, apply designer attribute and ready for to go ahead. As in the previous post I strongly advise to use ReSharper.

I’m going to show you how to create a similar functionality for your control’s smart tag as at Property view

Implementing this you can save a lot of time that was spent on browsing Property view in order to setup appearance and behavior.

Continue reading

Smart tag – Simple

Intro

For a long time I was wandering how easy and comfortable to work with smart tags. Actually I didn’t knew how it was called officially, but anyway I thought (and still think) that this feature is awesome! Some time ago I’ve started to develop my own components and also spend more time tuning user’s interface. I found that it’s very time consuming and boring to setup necessary properties from the Property view. Its okay to setup few controls in little program, but when you have over 30 complicated views with custom components – you quickly became in a sad mood. So I decide found out how to create for my controls those pretty little triangles on the top right corner at the most standard components.

I found articles, books; I performed several tests and finally made what I want. And you know, it’s really helps me with development! Time saving in action! )

Now I’d like to share how to make it from the very beginning.

For all described actions below I used VS2008, ReSharper5

What is smart tag?

Smart tags are menu-like user interface (UI) elements that supply commonly used design-time options. Most of the standard components and controls provided with the .NET Framework contain smart tag and designer verb enhancements.

You can find three main parts in a smart tag:

  • Verbs – looks like link and perform some immediate action with control;
  • Fields – there are may be many different editor types as on figure. String editor, image, binding, date.
  • Text – just a simple text for information or for something not editable.

Performing changes in smart tag, you change underlying control at the same time.

Continue reading