WPF endgültiv vorbereitet

This commit is contained in:
HuskyTeufel
2021-05-05 13:49:59 +02:00
parent 3d3de440ec
commit f66815fda5
7 changed files with 12 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GuiWPF" xmlns:local="clr-namespace:GuiWPF"
StartupUri="MainWindow.xaml"> >
<Application.Resources> <Application.Resources>
</Application.Resources> </Application.Resources>

View File

@@ -13,5 +13,11 @@ namespace GuiWPF
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
var window = new MainWindow() { DataContext = new MainWindowViewModel() };
window.Show();
}
} }
} }

View File

@@ -19,7 +19,7 @@ namespace GuiWPF
set set
{ {
this.Model.PageTitle = value; this.Model.PageTitle = value;
this.OnPropertyChanged("PageTitle"); this.OnPropertyChanged();
} }
} }
} }

View File

@@ -23,7 +23,6 @@ namespace GuiWPF
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
this.DataContext = new MainWindowViewModel();
} }
} }
} }

View File

@@ -19,7 +19,7 @@ namespace GuiWPF
set set
{ {
_currentViewModel = value; _currentViewModel = value;
OnPropertyChanged("CurrentViewModel"); OnPropertyChanged();
} }
} }

View File

@@ -19,7 +19,7 @@ namespace GuiWPF
set set
{ {
this.Model.PageTitle = value; this.Model.PageTitle = value;
this.OnPropertyChanged("PageTitle"); this.OnPropertyChanged();
} }
} }
} }

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -10,7 +11,7 @@ namespace GuiWPF
public abstract class ViewModelBase : INotifyPropertyChanged public abstract class ViewModelBase : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName) protected void OnPropertyChanged([CallerMemberName]string propertyName = "")
{ {
this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName)); this.OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
} }