Restructure View/ViewModels into their own distinct folders
This commit is contained in:
39
CefSharp.MinimalExample.Wpf/ViewModels/MainViewModel.cs
Normal file
39
CefSharp.MinimalExample.Wpf/ViewModels/MainViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using CefSharp.MinimalExample.Wpf.Mvvm;
|
||||
using CefSharp.Wpf;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
|
||||
namespace CefSharp.MinimalExample.Wpf.ViewModels
|
||||
{
|
||||
public class MainViewModel
|
||||
{
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
private IWpfWebBrowser webBrowser;
|
||||
public IWpfWebBrowser WebBrowser
|
||||
{
|
||||
get { return webBrowser; }
|
||||
set { PropertyChanged.ChangeAndNotify(ref webBrowser, value, () => WebBrowser); }
|
||||
}
|
||||
|
||||
private string title;
|
||||
public string Title
|
||||
{
|
||||
get { return title; }
|
||||
set { PropertyChanged.ChangeAndNotify(ref title, value, () => Title); }
|
||||
}
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
PropertyChanged += OnPropertyChanged;
|
||||
}
|
||||
|
||||
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "Title")
|
||||
{
|
||||
Application.Current.MainWindow.Title = "CefSharp.MinimalExample.Wpf - " + Title;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user