diff --git a/GuiWPF/App.xaml b/GuiWPF/App.xaml index 24a8184..f174034 100644 --- a/GuiWPF/App.xaml +++ b/GuiWPF/App.xaml @@ -2,7 +2,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:GuiWPF" - StartupUri="MainWindow.xaml"> + > diff --git a/GuiWPF/App.xaml.cs b/GuiWPF/App.xaml.cs index d79408d..deec891 100644 --- a/GuiWPF/App.xaml.cs +++ b/GuiWPF/App.xaml.cs @@ -13,5 +13,11 @@ namespace GuiWPF /// public partial class App : Application { + protected override void OnStartup(StartupEventArgs e) + { + base.OnStartup(e); + var window = new MainWindow() { DataContext = new MainWindowViewModel() }; + window.Show(); + } } } diff --git a/GuiWPF/HomePageViewModel.cs b/GuiWPF/HomePageViewModel.cs index 9ae6ef1..4c66efb 100644 --- a/GuiWPF/HomePageViewModel.cs +++ b/GuiWPF/HomePageViewModel.cs @@ -19,7 +19,7 @@ namespace GuiWPF set { this.Model.PageTitle = value; - this.OnPropertyChanged("PageTitle"); + this.OnPropertyChanged(); } } } diff --git a/GuiWPF/MainWindow.xaml.cs b/GuiWPF/MainWindow.xaml.cs index 395c653..9c30ad0 100644 --- a/GuiWPF/MainWindow.xaml.cs +++ b/GuiWPF/MainWindow.xaml.cs @@ -23,7 +23,6 @@ namespace GuiWPF public MainWindow() { InitializeComponent(); - this.DataContext = new MainWindowViewModel(); } } } diff --git a/GuiWPF/MainWindowViewModel.cs b/GuiWPF/MainWindowViewModel.cs index 5ac13ea..0e842f9 100644 --- a/GuiWPF/MainWindowViewModel.cs +++ b/GuiWPF/MainWindowViewModel.cs @@ -19,7 +19,7 @@ namespace GuiWPF set { _currentViewModel = value; - OnPropertyChanged("CurrentViewModel"); + OnPropertyChanged(); } } diff --git a/GuiWPF/SettingsPageViewModel.cs b/GuiWPF/SettingsPageViewModel.cs index 90d05b4..582d344 100644 --- a/GuiWPF/SettingsPageViewModel.cs +++ b/GuiWPF/SettingsPageViewModel.cs @@ -19,7 +19,7 @@ namespace GuiWPF set { this.Model.PageTitle = value; - this.OnPropertyChanged("PageTitle"); + this.OnPropertyChanged(); } } } diff --git a/GuiWPF/ViewModelBase.cs b/GuiWPF/ViewModelBase.cs index f65aa6d..f36842a 100644 --- a/GuiWPF/ViewModelBase.cs +++ b/GuiWPF/ViewModelBase.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq; +using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; @@ -10,7 +11,7 @@ namespace GuiWPF public abstract class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; - protected void OnPropertyChanged(string propertyName) + protected void OnPropertyChanged([CallerMemberName]string propertyName = "") { this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); }