❔ ✅ Textbox is way bigger than it is in designer C# / UWP / Blank App Template
Everything looks great in the designer but when you run it, you have to full screen it otherwise only the OK button will show, and when you do full screen it, the text box is way bigger than it should be. I'll attach a copy of the XAMAL code, thanks!
13 Replies
<Page
x:Class="Hello.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Hello"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid RowSpacing="2" ColumnSpacing="2">
<TextBlock TextWrapping="Wrap" Text="Please enter your name" Margin="531,32,703,926" Height="NaN" Width="NaN" FontSize="24"/>
<TextBox x:Name="userName" TextWrapping="Wrap" Text="TextBox" Margin="531,85,845,864" Height="NaN" Width="NaN" FontSize="24"/>
<Button x:Name="OK" Content="OK" Margin="808,91,0,0" VerticalAlignment="Top" FontSize="24"/>
</Grid>
</Page>
This is why
Margin
$rulesofwpf
❌ Avoid the WPF Designer to eliminate a category of confusing bugs ❌ Don't rely on Margin as the primary tool for layoutsUse layout controls
thanks...textbook im reading for class instructs me to...lol
😂 You should get a refund for that book
no shot someone was that confident enough in doing something so wrong that they decided to write a whole book about being wrong
that's insane
get this...it's for VS there a command that says how to use layout controls?
No, but there are docs
https://learn.microsoft.com/en-us/windows/apps/design/layout/
okay, i'll give it a shot
i can't believe i'm doing this shit...thanks guys
No clue why Microsoft decided the idea to use Margin for the designer was a good idea.
Thanks again!
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.
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.