Custom silverlight user controls do not appear in Blend Assets tab - silverlight

I've created a control in blend (xaml and code behind), saved it, and rebuilt the entire project. Now, not only does this new control not appear in the Assets tab in blend, none of the other user controls i've created appear either. I've rebuilt several times, blown away the obj and bin directories and rebuilt again, to no avail. How do I get my user controls to appear in the Assets pane so I can use them in my project?
thanks
Blend: 3.0.1927.0
VS: 9.0.30729.4108 QFE
.NET: 3.5 SP1

Sweeney,
I don't have the specifics of your install environment or applications installed, but using what I have, I can create a custom user control in blend and compile, pull it from my assets library, and put it on my page. Here are my specs, maybe you can check to see if you're running a different version or such:
Microsoft Expression Blend 2 Service Pack 1 - Version 2.1.1760.0
Microsoft Visual Studio 2008 - Version 9.0.30729.1 SP
Microsoft .NET Framework - Version 3.5 SP1
Here is what I did to create my custom control:
Open Blend.
Create new project (File > New Project..., Then named my Silverlight 2 Application, and clicked OK.)
Create new UserControl (File > New Item..., Then named my UserControl, and clicked OK.)
Create something like a colored background and text so that the control can be seen.
Build the application.
Add my custom control to the Page.xaml file from the Asset Library. (This may be where you got tripped up, please see below).
Size my new control.
Final product:
Screen Shot http://img163.imageshack.us/img163/7554/finalproduct.jpg
Accessing Custom Controls in Asset Library
Click the Asset Library icon (left side by default): Asset Library http://img43.imageshack.us/img43/2198/assetlibrary.jpg
Click the Custom Controls tab (top of Asset Library window): Custom Controls http://img5.imageshack.us/img5/8915/clickcustomcontrols.jpg
Select your custom control: Custom Control http://img693.imageshack.us/img693/1684/customcontrol.jpg
Place them on your page to your hearts content.
I hope this helps you,
Thanks!

Related

WPF: How to know Open Window, User control name

In the web application, we just right click on the page go to properties and can see the opened page path. How to achieve this in WPF application. I am running a WPF app having windows with many user control. I want to edit a user control. So I want to know its name and location in my project folder.
That is not possible like how you can in a web application, however there are some tools that can help you.
WPF Snoop
Used to inspect WPF application rather like 'Inspect Element' in a webpage. After inspection, pressing ALT+SHIFT will higlight what element is under the mouse and show you its name. Then you can search for that name in Visual Studio to find the class to edit.
See https://github.com/snoopwpf/snoopwpf
Visual Studio XAML Inspector
The microsoft version of the above 'Live Visual Tree Inspector' now built into Visual Studio and compatible with .NET Core 3.0 as well as .NET Framework.
See https://learn.microsoft.com/en-gb/visualstudio/xaml-tools/inspect-xaml-properties-while-debugging?view=vs-2019

WinForms.net: a control for one project only

I want to make a composite control which I could drag to form multiple times, but this control should reside in one project only. I do not like the idea of making a control, and installing it to be visible to all projects in a Visual Studio 2010 Toolbox.
So, I assumed that the UserControl is what I needed. I created one, but now can't drag it to a form or find it in the Toolbox.
Tools > Options > Windows Forms Designer > AutoToolboxPopulate is set to True.
I had to compile the project to make UserControl appear in the Toolbox.

How can I make Visual Studio 2010's "Add User Control" create a WPF control?

I have a class library that I created using the "Class Library" project template. If I right-click on this library in Solution Explorer and select "Add > User Control", Visual Studio adds a WinForms UserControl. That's not what I want -- I want "Add > User Control" to add a WPF user control.
I've already added references to the WPF assemblies (WindowsBase, PresentationFramework, and PresentationCore), and I already have some WPF UserControls in this library, and everything compiles. My library does not have references to the WinForms assemblies (System.Drawing and System.Windows.Forms). But apparently the proper references are not enough of a clue for Visual Studio, because when I try Add > User Control, it adds the WinForms references to my project, and then creates a WinForms UserControl.
I can add a WPF User Control to my WPF Application project, and then move it into my library. But that's a pain, and I'd rather have it work properly in the first place.
I think I'm probably missing some kind of arcane XML element in my .csproj file that tells Visual Studio which designer to use by default, and if I add the right XML element with the right cryptic GUID, it will start working properly. If I could create a new WPF Control Library, I could probably compare the two project files and figure this out. However, I'm using Visual C# Express, which doesn't have a template for a WPF Control Library project, so I'm out of luck there.
What do I need to do to my Class Library's .csproj file so that VS2010's Add > New User Control will add a WPF UserControl?
There are sub-projects class ids in the project file that affect the Visual Studio context menus and how the project behaves in general. The easiest thing to do is to recreate the project as a:
WPF User Control Library
instead of a "Class Library". It is possible if you already created the project to edit in the sub-project class ids by hand by opening the ".csproj" file in a text editor such as Visual Studio itself but its easy to cause more damage than you fix that way.
I believe but haven't test that another type of library will also work:
WPF Custom Control Library
which is intended to hold other types of controls than UserControl objects but being a WPF sub-project type the context menus also work correctly for the use case you are describing.
Edit:
For completeness, I've just tested how to manually add the sub-project GUIDS. Add this line to the first PropertyGroup in the .csproj file:
<PropertyGroup>
...
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
</PropertyGroup>
Not tested with Visual Studio Express.

Building Visual studio like application, need inputs

I am working on a Visual studio like application i.e. have a toolbox, an editor and property grid similar to VS.
User can drag and drop the controls(custom and third party) to the editor window and perform operations like resize, move, align, group etc.; Properties of that control needs to be displayed in property grid and user can update them from there.
As per my current understanding I will have to extend the Canvas to create my own editor and and Interface for controls which it supports; Each supported control will have to implement this interface so that it can be placed in our editor.
Something similar to this - http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part4.aspx
Looking forward for any kind of help, comment or links.
If WPF is a requirement, wait for the VS2010 release and use the Visual Studio Shell in either isolated mode or integrated mode. Otherwise you can use the Visual Studio 2008 Shell isolated or integrated.
You'll get the docking support, addin model, editors with highlight and much more almost for free that way.
Finally, I used the Diagram designer approch to build my application. Although, I had to create my custom property grid which was painful.
Recently I came across following post which suggests that .Net DesignSurface can be used for building this kind of application -
How to create an UI Designer utility?
I have been working on a generic framework Wide to create VS like applications.
Update: Here is the CodeProject article on how to use the framework.
Wide comes with two modules and various out of the box functions:
Core module (Required)
Used for customizable splash screen
Used for Menus (supports regular menus with icon, checkable menus)
Used for Toolbar (menu view model can be reused for toolbars)
Multiple toolbars can be added to the IDE (check demo)
Themes (VS2010, VS2012 Light theme and no theme)
ThemeManager to add/remove themes
Used for Statusbar (in development)
Open file service with participatory handlers (could be based on extension or even file contents)
Save and restore layout along with opening documents
Logger module (For the logging tool)

How to create a control like Solution Explorer in Visual Studio?

I want to create control that seems and works like the Solution Explorer of Visual Studio.
I mean not the functionality of solution explorer, the control should be seems like that control. That means, server explorer, toolbox, error List,... All these controls will pop-out when we put mouse and pop-in when we leave. We can lock and unlock those controls also.
So can anyone help me, to get the solution for this problem.
Thanks!!!!!!!!!!!
I am assuming you are using C#/VB.NET for development. The dockpanel suite will provide a docking framework for an application. Basically in terms of dockpanel, it is the forms which can be docked on the application using drag and drop like visual studio.
So create a treeview control in the form and dock it to the parent. You can populate the treeview control based on file directories or any specific needs of your project. Please note in dockpanel you create a form by not inheriting from Form class but from DockContent class. Documentation will give you more insight of how to create applications. It has a good example along with the source code in which it simulates the all the visual studio panes. It also provides and option to save the position of various docks which can act as a user preference. For eg, you may like to position solution explorer on left side whereas i may want it on right side. this get stored in a conf file which gets read next time when you start the application.
Incase you using MFC, then visual studio 2008 SP1 provides you with docking framwork and within that use the treeview control.
XAML also provides a docking framework. But i am not sure, you need to verify.
Win32 API does not have any native docking framework.

Resources