problem is when i set my windowstyle to none and change resizemo开发者_StackOverflow社区de to no resize, and run it, the height and width is bigger at runtime
I'd say you've either set the height and width of the window to be larger than the window would automatically size to adjust to its contents. Or done the opposite.
EDIT
Ok, so considering the new information in the comments below:
The reason why the button's position has changed is because you've explicitly set the Margin
of the Button
to be 203 units left and 209 units down from the top left point of the containing panel (I.E. your grid; Which is why it appears where it does.
I'm unsure why the preview is incorrect in this case.
In my case the XAML tag of the Window had the Property SizeToContent="True" and all I had to do was to remove it.
精彩评论