Using widgets from the toolbox
- This is a beginners question but I can't seem to add any widgets from the tool box on to the designer. I thought it was suppose to be as simple as drag and drop. Any type of widget I choose from the tool box wont go on the designer.
For example I could pick a button from the controls and it wont let me drag and drop. I also tried selecting the button and dragging a rectangle on the canvas, no luck with that either.
Any clue?
Thanks,
Dave
Answers
This problem can occur if you have old Toolbox Database (TBD) files on your machine (e.g. from earlier pre-release versions of VS2008). You can work around the issue by deleting the TBD files which are found in your user profile:
1. Exit Visual Studio
2. Navigate to your user profile directory for Visual Studio (this is found at %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\9.0)
3. Delete the TBD files found there (they are often hidden files)
4. Re-start Visual Studio and open your WPF application - the toolbox should be automatically rebuilt (which can take a while depending on your machine's performance). You should now be able to drag/drop controls onto the design surface as you would expect.
Note also that the Toolbox only shows controls in RTM Visual Studio 2008 in the WPF designer when the Designer Pane is selected (not the XAML Pane). This behavior is likely to improve in a future SP or version.
Mark
Right arrow is the way to get outside the automatically added attribute quotes. But if this behavior does not suit you, you can change it. To do so, go to Tools...Options...Text Editor...XAML...Miscellaneous, and uncheck the Auto Insert checkbox for Attribute Quotes. This way you will get only the first quote, and you'll have to add the final quote when you're done typing.
There are lots of other XAML formatting settings in that Options dialog too - they give quite fine-grained control over the way the XAML editor works for you. Walt Ritscher has written a couple of nice blog posts over at http://wpfwonderland.wordpress.com/2007/11/20/xaml-editor-preferences-in-vs-2008-part-1/ that describe the features pretty well.
Mark
All Replies
Are you using one of the WPF project templates? (i.e., WPF User Control, WPF Custom Control, WPF Application)
This problem can occur if you have old Toolbox Database (TBD) files on your machine (e.g. from earlier pre-release versions of VS2008). You can work around the issue by deleting the TBD files which are found in your user profile:
1. Exit Visual Studio
2. Navigate to your user profile directory for Visual Studio (this is found at %USERPROFILE%\AppData\Local\Microsoft\VisualStudio\9.0)
3. Delete the TBD files found there (they are often hidden files)
4. Re-start Visual Studio and open your WPF application - the toolbox should be automatically rebuilt (which can take a while depending on your machine's performance). You should now be able to drag/drop controls onto the design surface as you would expect.
Note also that the Toolbox only shows controls in RTM Visual Studio 2008 in the WPF designer when the Designer Pane is selected (not the XAML Pane). This behavior is likely to improve in a future SP or version.
Mark
- Thank you,
Just another simple beginner question -
When I type = in XAML code it inserts ="" and places the cursor inbetween the two quotes. I was watching a video yesterday and it seemed like when he was done typing he was able to get his cursor outside the quotes. I've tried enter, tab, space, escape but they don't work. Or is the only way to hit right arrow and if thats the case can I turn this feature off?
-= Dave Right arrow is the way to get outside the automatically added attribute quotes. But if this behavior does not suit you, you can change it. To do so, go to Tools...Options...Text Editor...XAML...Miscellaneous, and uncheck the Auto Insert checkbox for Attribute Quotes. This way you will get only the first quote, and you'll have to add the final quote when you're done typing.
There are lots of other XAML formatting settings in that Options dialog too - they give quite fine-grained control over the way the XAML editor works for you. Walt Ritscher has written a couple of nice blog posts over at http://wpfwonderland.wordpress.com/2007/11/20/xaml-editor-preferences-in-vs-2008-part-1/ that describe the features pretty well.
Mark


