How to change the size of a screen through an event in C # WPF

2

How can you make a change in the size of a Window in WPF, changing its Heigth and Width and thus increasing and decreasing the screen according to the values reported? For example: I have a button (Increase Screen) and when the event refers to this button is executed a

button_click(){
   Form.Width = NovoValor;
   Form.Heigth= NovoValor;
}
    
asked by anonymous 21.07.2017 / 18:53

1 answer

1

You also need to set the properties MinWidth and MinHeigth .

private void button_Click(object sender, RoutedEventArgs e)
{
    MinWidth = novaLargura;
    Width = novaLargura;
    MinHeight = novaAltura;
    Height = novaAltura;
}
    
21.07.2017 / 19:15