Answer the question
In order to leave comments, you need to log in
How to properly mark up a window in WPF markup?
Good afternoon. I took up the study of WPF markup, trying to mark up a simple window and ran into an unpleasant thing, when the window expands to the entire window, the elements on the form increase in size.
In my case, these are buttons and comboboxes, I would like to leave the buttons of the previous size, and text fields would fall under the increase. Another problem with the label, I'm trying to make indents like a textbox 10 pixels from the edge of the form, the textbox shows the indent correctly and the label goes further. Screenshot attached.
The markup code itself:
<Grid>
<Grid.RowDefinitions >
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Menu Height="25" VerticalAlignment="Top" Background="White">
<MenuItem Header="Файл">
<MenuItem Header="Печать" ></MenuItem>
<Separator />
<MenuItem Header="Выход" ></MenuItem>
</MenuItem>
<MenuItem Header="Режим" >
<MenuItem Header="PS4"/>
<MenuItem Header="XboxOne" />
</MenuItem>
<MenuItem Header="О программе" ></MenuItem>
</Menu>
<ComboBox
Grid.Column="0"
Margin="10,80,50,30"
/>
<ComboBox
Grid.Column="1"
Margin="10,80,50,30"
/>
<Label
Grid.Row="0"
Margin="10,105,0,0"
Content="Поле ввода:"/>
<Label
Grid.Row="2"
Margin="10,105,0,0"
Content="Результат:"/>
<TextBox
Grid.Row="1"
Grid.ColumnSpan="5"
Margin="10,0,10,0"
Text="Source"
/>
<TextBox
Grid.Column="0"
Grid.Row="3"
Grid.ColumnSpan="5"
Margin="10,0,10,0"
Text="Result"/>
<Button Grid.Column="4" Content="Convert" Grid.Row="4" Margin="0,10,10,90"/>
</Grid>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question