Answer the question
In order to leave comments, you need to log in
What's with the weird indentation when creating elements in Visual Studio?
Why does Studio set margins for elements?
For example, I throw a button on an empty form without changing anything and get this code in xaml
<Button Content="Button" HorizontalAlignment="Left" Margin="761,364,0,0" VerticalAlignment="Top"/>
<Page
x:Class="camApp.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:camApp"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Button Content="Button" HorizontalAlignment="Left" Margin="761,364,0,0" VerticalAlignment="Top"/>
</Grid>
</Page>
Answer the question
In order to leave comments, you need to log in
Because when you put an element in a certain place on the form, in order for it to be there, the studio sets the appropriate indents, otherwise it will be in the upper left corner.
I would advise not to use a designer, but to write xaml code by hand, so you have better control over the markup
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question