Set button controls as minimize/maximize/close buttons in NavigationWindow application?

3.1k views Asked by At

I am newbie in WPF and C#, but I started to develope a WPF NavigationWindow application. I want it to be chromeless window with custom maximize/minimize controls. But when I set events for my buttons, they don't affect the window.

Here's my XAML:

<NavigationWindow x:Class="app.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="app title" Height="600" Width="800" MinHeight="600" MinWidth="800" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Icon="appIcon.ico" Source="starting.xaml">
</NavigationWindow>

here is my click event for the button:

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MainWindow window = new MainWindow();
            window.WindowState = WindowState.Minimized;
        }

Forgive me, if I am duplicating question, and also keep in mind, that I am new in this kind of programming :) so help, please

1

There are 1 answers

2
LarsTech On BEST ANSWER

Don't make a new window, try using the one you are using.

Try this:

// MainWindow window = new MainWindow();
this.WindowState = WindowState.Minimized;