❔ ui page : button offset
hello guys i have a frame displaying a page where i have a button, however there's an offset when i run the app
here is my xaml button :
<Button x:Name="testbutton" Content="Button" HorizontalAlignment="Left" Margin="40,247,0,0" VerticalAlignment="Top" Style="{DynamicResource ButtonStyle1}" Background="#FF24262F" Foreground="#FFBFBFBF" FontWeight="Bold" Width="55"/>
i'm still pretty new to xaml and i have no clue what could be the issue. Thanks for your help in advance
5 Replies
$rulesofwpf
Your issue lies here:
As Margin is the spacing between elements, it messes up layout when resized or when layout changes.
You must use the layout controls, such as Grid, StackPanel, DockPanel, etc.
Instead of the designer, write XAML by hand and rely on the hot reload.
Just debug your app, make changes in the XAML, save it (CTRL + S) then the changes will be visible in the running app directly.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.