I need to make this textbox not move
```c#
<Window x:Class="Password_manager.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Password_manager"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="400">
<Grid>
<Label Margin="25">Select account</Label>
<ComboBox Name="AccountBox" Width="140" Height="30" Margin="25,48,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
</ComboBox>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Height="40">
<Run Text="Password: "/>
<Run Text="{Binding ElementName=AccountBox, Path=SelectedItem}"/>
</TextBlock>
<TextBlock x:Name="AccountPassword" Width="300" Height="40" FontSize="30"/>
</StackPanel>
</Grid>
</Window>
19 Replies
because you're horizontally aligning it, so it will expand to both sides
to keep it centered
taky řešíš závěrečku?:kekw:
he knows
Do you also deal with the final exam?
yep
Keep it English This server is an English-first server. Keep voice and text channels in English to aid moderation and communication. Check how-to to create localised channels for translation purposes.#info-and-rules
Please do not use the designer
$rulesofwpf
Margin is the spacing between elements, not absolute position
Not using designer
Why is the button now displaying?
<Window x:Class="Password_manager.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Password_manager"
mc:Ignorable="d"
Title="MainWindow" Height="300" Width="400">
<Grid>
<Label Margin="25">Select account</Label>
<ComboBox Name="AccountBox" Width="140" Height="30" Margin="25,48,0,0" HorizontalAlignment="Left" VerticalAlignment="Top">
</ComboBox>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock Height="40">
<Run Text="Password: "/>
<Run Text="{Binding ElementName=AccountBox, Path=SelectedItem}"/>
</TextBlock>
<TextBlock x:Name="AccountPassword" Width="300" Height="40" FontSize="30"/>
</StackPanel>
<Button Width="120" Height="20" Margin="20,190,255,75" Click="Button_Click">Create New Account</Button>
</Grid> </Window> Also doesn't work
</Grid> </Window> Also doesn't work
works for me
and I explained above why yours doesnt work
ah yeah change orientation to vertical
and remove the label margin
if you want to space things around more, the use grids and look into the link I sent above about grids
its explains how u can do it
thankas
that is the exact same as the video about
https://wpf-tutorial.com/panels/grid/
https://wpf-tutorial.com/panels/stackpanel/