Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I create a small application in which, i want when my window(WPF) is maximized it's controls are also resized according to window size.I tried this code-

Private Sub Maximize_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Maximize.Click
If Me.WindowState = Windows.WindowState.Maximized Then
        Me.WindowState = Windows.WindowState.Normal
        Me.Width = 820
        Me.Height = 440
        Me.Grid1.Width = 780
        Me.Grid1.Height = 400
        Me.StackPanel1.Height = 360
        Me.StackPanel1.Width = 140
        Me.StackPanel2.Height = 360
        Me.StackPanel2.Width = 600
 Else If Me.WindowState = Windows.WindowState.Normal Then
        Me.WindowState = Windows.WindowState.Maximized
        'Me.Width = 1350
        'Me.Height = 600
        Me.Grid1.Width = 1300
        Me.Grid1.Height = 600
        Me.StackPanel1.Height = 460
        Me.StackPanel1.Width = 200
        Me.StackPanel2.Height = 460
        Me.StackPanel2.Width = 800
End Sub
Posted
Updated 8-Aug-13 22:27pm
v2

1 solution

Set Control AutoSize=true Property
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900