简体   繁体   English

VS 2012中的WPF设计器问题

[英]WPF designer issues in VS 2012

I'm new to WPF and I'm having problems in building a simple UI. 我是WPF的新手,在构建简单的UI时遇到问题。 When I place a button at a random position in the window it doesn't appear EXACTLY where it would appear in the designer. 当我将按钮放置在窗口中的任意位置时,它没有完全显示在设计器中。 Why's that, there wasn't such problem with the Windows Forms designer, let's say. 为什么这样呢?假设Windows Forms设计器没有这样的问题。

Here's a screenshot of what I mean: http://s14.postimg.org/kjs0vvpqn/wpf.png 这是我的意思的屏幕截图: http : //s14.postimg.org/kjs0vvpqn/wpf.png

Isn't there a way to make the button appear exactly how it would appear in the designer? 是否没有办法使按钮完全像在设计器中那样显示?

If you want to place a button to have a WYSIWYG position, wrap it into a Canvas , rather than a grid or StackPanel. 如果要放置具有所见即所得位置的按钮,请将其包装在Canvas中 ,而不是网格或StackPanel中。 For grid or stackpanel, the position is controlled by HorizontalLayout, Margin, Padding etc., whereas for Canvas, you can set the top and left property directly. 对于网格或堆栈面板,其位置由Horizo​​ntalLayout,Margin,Padding等控制,而对于Canvas,则可以直接设置top和left属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM