Question

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

Was it helpful?

Solution

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

Try this:

// MainWindow window = new MainWindow();
this.WindowState = WindowState.Minimized;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top