How can I prevent the VS WPF designer from putting fields on each object from the toolbar?

When I drag a control from a toolbar onto a Visual Studio 2008 WPF design surface, it sets a marker based on where I dropped it and the default size.

Is there any way to prevent VS installation? When I drop the control on the stack, I want it to jump to the existing controls in the panel.

Thanks!

+5
visual-studio-2008 wpf wpf-controls designer
source share
3 answers

I have never found a way to prevent this. I'm just typing XAML.

EDIT

I wrote above almost three years ago. At the same time, it seems that the development-time experience has become much better.

While the developer still adds hard-coded fields if you drag and drop, there are ways to remove these fields without having to do it manually.

Here is a link to an article that shows how to use design tools in Visual Studio 2010 to lay out a form without entering any XAML. (Despite the name, it's about WPF.)

Build Methods for Windows Form Developers

+3
source share

When I drop the control on the stack, it does not add fields; it "flows" along with the rest.

The controls that you throw onto the design surface have a default by default, because it knows where it is. Usually I create a grid and set it where I want, and then create columns and rows for input controls. I am throwing into my other controls that will add fields that are usually not what I want. After I have all my controls in my grid reasonably placed, I switch to the XAML view and completely remove the margin (which causes the control, for example, the button to fill the entire space), or makes the margin about 5, which puts Some nice addition around the control.

Bottom line ... and this is especially true for Silverlight development, you should get used to manipulating XAML directly. This is the only way to get the layout where you want. This is my opinion and most in my store who develop WPF / Silverlight.

0
source share

Unfortunately, there is no means for this.

The default size is set as a result of the fact that you control the size of your designer control. When you increase the width and / or height of a control, the designer interprets your actions as a request to make the control a given width and / or height.

A similar situation occurs with fields. As the position of your control in the designer changes, it changes the properties to achieve the layout you created. In the case of most containers, the simplest solution is to change the fields to achieve the desired position, since you have already indicated that a solution for simple solutions is not always the most desirable.

Personally, I prefer to use only the XAML editor and only occasionally pick a peak in WPF Designer when I want to see the current layout. I also prefer to use Grid to layout most of my windows / controls, as it provides maximum flexibility not only for sizing and positioning, but also for other tasks / functions such as animations, transformations, etc.

0
source share

All Articles