Is there a way to disable the design view of an individual UserControl - without disabling the design view for other controls?
Certain controls of mine do not support design view, and in these cases I would prefer them to just load up the xaml editor.
Is there something I can place in the code to disable the design view?
This question intrigued me. I never use the VS designer anyway. For visual tools I prefer Blend. I only use VS for editing the XAML directly (or code).
If you want to go straight to the XAML editor instead of the designer, here's an option. I don't know of any way to disable the designer only for certain views. I suspect that it is not possible unless you write a VS extension.
Related
I'm an experienced C++/Qt developer but a newbie C#/WPF developer, and I'm wondering if I'm missing something with the Visual Studio 2010 WPF designer.
In Qt, all widgets have a parent. I found this concept very useful both when building GUI programmatically and in the designer. From what I remember from Qt desginer (unfortunately my new company doesn't support Qt), you could easily drag widgets around and they get re-parented correctly. If the designer somehow got confused, then you could just reset the parent to whatever you needed in the properties box. I find the analogous ideas in WPF difficult to execute.
In the Visual Studio Designer, when I drag widgets around, they only sometimes get the right parent. More often than not, I have to go to the xaml and cut-and-paste the widget I was writing into a different part of the xaml so that it gets the right parent. I understand that the DOM tree of xaml nicely parallels the widget parent tree, but I found that was much more explicit in Qt.
So, my question is: is this cut-and-paste approach to re-parenting in WPF xaml the best you can do or are there some nice designer tips-and-tricks that I am missing?
Note: this question obviously doesn't apply when building GUI programmatically.
In my experience this boils down to a lacking designer in VS2010. Personally I use the designer for WPF as a view on how the GUI will look, and then hand code most of my XAML. I almost never actually DO anything in the designer such as drag an element or such.
To answer your question, the cut-paste in xaml approach you mention is in my experience the most efficient way to "re-parenting" elements.
I started with wpf 4.0. I have a textBox where i shall enter linq expressions. So i want to enable intellisense support in the textEditor. All i do now is bringing a popUp which has the list of items. Do i have anyother way to do this in WPF.
Thanks.
No, none of the built-in controls provide Intellisense functionality. It's a feature provided by code editors, and I doubt Microsoft intends for you to re-implement Visual Studio.
You'll have to write it yourself. See here for a sample: Intellisense-like Method Selection Pop-up Window
A commercial control package is another option. For example: Actipro's WPF SyntaxEditor
I was wondering how programmers chose to edit XAML. Most of the programmers I speak to seem to edit the raw XML, but that seems nuts to me since it is such a natural thing for a more visual editor (of course you often have to get down to the raw code ultimately, but isn't there a better way to lay out a grid, or edit a template, or add non c# triggers or manage commands? The one that really set me off was editing a menu -- Visual Studio 1.0 had a better menu editor for C++ than the raw XAML editing experience.)
When I edit .aspx files I use a visual editor much of the time, and then for the raw stuff I get into the html code.
I am aware of Expression Blend, but that seems far more focused on artistic types and GUI experts rather than programmers.
Does anyone have recommendations for a better editor for XAML than VS? Especially so since VS seems to have real nasty problems with XAML editing too, like bugginess and poor performance?
Appreciate your helping this XAML newbie.
I must agree that Blend has the best XAML editor I've tried. While VS2010 has made some significant improvements over 2008, it's not at the same level as Blend, and still feels a little clunky and is prone to freaking-out.
A good option for doing quick and dirty XAML editing is Kaxaml, a small editor which can be thought of as NotePad for XAML. It's fast(er than VS), has syntax-highlighting, auto-completion and an in-editor preview. I find it quite useful to use alongside VS, although it is limited for serious work.
The Visual Studio 2008 visual editor for XAML is still fairly primitive as you've encountered. When it comes down to wanting a true visual editor for XAML files, Blend is your best bet.
Like you, I originally thought Blend was targeted more for designers, but after using it for awhile now, I've found that Blend is clearly the best tool to visually edit XAML files. And since Blend integrates with Visual Studio Team System, you are able to switch between Visual Studio and Blend fairly seamlessly.
I use Blend when I'm doing visual tweaking or setting up Storyboards. I'll sometimes use it when first laying out a window, as well, but I've found that it's often easier to just hand-code the XAML rather than relying on Blend to guess the layout I want. I use Visual Studio when I'm doing XAML editing by hand, as it has better Intellisense and automatic formatting than Blend. I never use the visual editor for WPF in VS.
Part of the challenge here is that XAML layout is much more sophisticated than WinForms, so simple drag and drop doesn't quite cut it anymore. Blend does a pretty good job of guessing what I want, but if I really want to clarify how the visuals should be laid out, it's easier to express by typing the XAML, now that I'm familiar with it.
My typical workflow:
Create the initial layout by entering XAML in Visual Studio for the Grids, StackPanels, DockPanels and what have you that will lay out the window or control. I may also drop in some of the other controls as well, if the layout is simple.
Open up Blend and use it to place smaller controls, edit control properties and create/associate any styles I need. If I need custom control or data templates, I'll create them from Blend and then repeat the VS/Blend process on those templates.
Go back to VS and edit the XAML to set up my designer data context and manually code the data bindings.
Use Blend to verify the look of the finished window or control with the designer data context, tweaking and styling as needed to polish the UI.
I go back and forth a lot, but I'm typically also approaching it from a different mindset with each tool. If I was working with a larger company, I suspect most of what I do in Blend would be handled by a graphical designer, which is I think the intention. I don't mind wearing both hats, though and I've become accustomed to using both tools, as needed.
Visual Studio 2008 isn't the tool to edit WPF window. It falls in error usually if you uses a complex xaml type or some advanced styles.
Visual Studio 2010 has added a lot of new features in editing and specially designer for binding and IntelliSense for xaml too.
Blend is true that is oriented for designers like Microsoft want to sell it but I find it more like the missing feature of the designer of VS.
Blend has an advanced editor for styles and animation and helps a lot to generate.
But Blend lacks terribly in editing raw XAML, it has no IntelliSense at all.
My choice is to use both VS 2010 and Blend specially for styles and animations.
Expression Builder is a good free tool
I have a project with 100's of usercontrols. When I load the project in VS2010 and try to open a designer, the toolbox spins and spins until they're all loaded.
Winforms has a "AutoToolboxPopulate" switch under Tools/Options/Winddows Forms Designer/General.
I cannot find a similar switch for the XAML designer. Does one exist?
In VS2010, the Auto Populate Toolbox switch for XAML can be found under Tools/Options/Text Editor/XAML/Miscellaneous.
If you wish to keep the Auto Populate enabled, you can decorate your usercontrol classes with the System.ComponentModel.DesignTimeVisibleAttribute which will allow you to specify if they appear or not in the designer.
Unfortunately there isn't one that I am aware of, with the exception of actually adding a design-time (*.Design.dll) assembly for the project that effectively defines metadata to hide the explicit controls.
This bit me as well recently and I wish I had a solution like the old winforms attribute!
I just wanted to do some tutorials in WPF but I find that the designer works very slow in comparision to Windows Forms/GDI+.
Are there any tweaks to speed it up?
If you're just after a bit of XAML editing, you can use a separate editor, such as XamlPad. That has much quicker rendering than the VS designer.
I turned it off.
Right click the xaml file in Solution explorer,
use Source code (Text) Editor
Set it as default
Good thing is Intellisense still works!
In case you need to view the Design view occasionally, you can still Right click -> Design view.
Turn it off. The VS XAML designer is awful and doesn't work anyway as soon as your XAML is non-trivial. Go into your options and map the .xaml extension to the regular XML Editor.
you can look in the following link.
quite same as the previous answers."How to speed up Visual Studio 2008's slow WPF designer"