July 24, 2013

Toolbox Icon For WPF Custom Control

Problem: 
- Displaying a custom Icon on the Toolbox for a Custom Control
- A Toolbox Icon for a WPF Control
- How to add a custom Toolbox icon to a WPF custom control In Visual Studio 2012
- Add a custom control icon to the tool box in VS2012

Solution:
I test more solutions but this solution helps me and it's simplest as i think so.
Just Add a picture file (not just bmp file) to a folder (not a specific folder) with these conditions
- Name: must be a full control name + icon + extension like below example
Structure: FullControlName.icon.ext
Sample Name: Project1.Control1.icon.png
Sample Name: WpfApplication1.Forlder1.CustomControl1.icon.bmp

- Right Click > Properties > Build Action > Embedded Resource (Just Embedded Resource no Resource or another one)


Test:
These icons just appear, when use of your DLL and in Design Time, visual studio just use of default icons.

- Go to ToolBox > RightClick > Choose Items... > WPF Components > Browse... > Add the DLL of your project and enjoy of ICON :-)


No comments: