Silverlight Tools for Visual Studio 2008 - Placing

2019-07-09 19:35发布

问题:

What is the issue with the Silverlight Tools for VS2008? I can't seem to place controls on the designer surface. This didn't work for me on two different machines. Do you have to tweak the XAML to be able to place the first control?
Cursor stays a compass-like-cross when over the surface. Are you supposed to drag-n-drop controls or draw them?

Screenshot (as far as I got)

回答1:

This is in response to your request for my thoughts on this question from your comments on this post.

As both Aaron Fischer and Boyan have mentioned, the Visual Studio 2008 Silverlight 2 Designer installed by the 'Microsoft Silverlight Tools for Visual Studio 2008 SP1' package is currently read-only.

In Visual Studio 2008 you cannot currently drag and drop Silverlight 2 controls from the Toolbox onto the designer. You can however drag controls from the Toolbox to the Xaml editor if your place your cursor in the Xaml editor before initiating the drag.

This will more than likely change in a future version of the tools package, possibly this year. There will be a few announcements on Silverlight 3 at MIX 09, I don't know if this will be one of them.

To get design control over your Silverlight 2 Xaml you need to install Expression Blend 2. You can download a trial here, make sure you also install Service Pack 1 from here. If you have this installed then right click on Page.xaml in Visual Studio 2008 and select 'Open in Expression Blend...'

Once open in Expression Blend you can drag and drop controls from the toolbox onto the designer. In Expression Blend 2 the Toolbox is called the 'Asset Library' and it can be accessed by left clicking the double right arrow >> at the bottom of the list on the left of the screen:

Once the Asset Library is open, a good tip if you can't find the control you are looking for (you mention you cannot find the Button control in Expression Blend 2) is to type it's name in the Search area at the top left or click the 'Show All...' check-box as shown above.

This blog post is a good place to start for a First Look at Using Expression Blend with Silverlight 2 with plenty of screenshots. There are also some follow up videos to that blog post called Introducing Blend To Silverlight Developers and Silverlight Programming And Expression Blend that you can watch.



回答2:

As pointed out by Aaron Fischer, for the time being the VS Silverlight designer is read-only. I'd just like to add that you still can drag-and-drop controls from the toolbox into your XAML markup. That's especially helpful when you add a control from an external assembly - say, a DataGrid - because it automatically creates the reference to the assembly and maps the appropriate namespace.



回答3:

The designer is read only. Your have to use expression blend until vs 2010