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.
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.
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.
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:
- Add sign to assembly;
- Install assembly to GAC;
- Add to Visual Studio “Add reference…” dialog;
- 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. ;)
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.