❔ wpf : I don't want blind contents like buttons textbox when I window size is change
I want the text box inside the panel to be automatically adjusted according to the size of the window, and the button to remain the same size and not be covered by the window.
In conclusion, I don't want buttons and textboxes to be covered by windows.
<Window x:Class="StickyNotes.App.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:StickyNotes.App"
mc:Ignorable="d"
WindowStyle="ThreeDBorderWindow"
Title="MainWindow" Height="600" Width="500" > <StackPanel Orientation="Vertical"> <StackPanel Name="st" Orientation="Horizontal"> <TextBox Width="320"></TextBox> <Button>Btn1</Button> </StackPanel>
</StackPanel>
</Window>
Title="MainWindow" Height="600" Width="500" > <StackPanel Orientation="Vertical"> <StackPanel Name="st" Orientation="Horizontal"> <TextBox Width="320"></TextBox> <Button>Btn1</Button> </StackPanel>
</StackPanel>
</Window>
8 Replies
the result i want finally You can see red part. When Window size is small, Contents isn't blind
Are you using the designer? Don't
You set the size of the textbox to a fixed number, that will not scale
I didn't use blenzer ? Im just exercise wpf (with xaml)
Leave Width and Height empty if you want them to scale
$rulesofwpf
Umm.. Im just don't want make blind button by window when I resize window
You can use DockPanel control
You can dock the textbox to the left, and the button to the right.
Note that textbox has to be the last element because only the last element is filled to the remaining space
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.