Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,27 @@ It is inspired by [Caliburn.Micro](http://caliburnmicro.com/), and shares many o
Getting Started
---------------

### .NET 5.0+ / .NET Core
### .NET 6.0+ / .NET Core

For .NET Core and .NET 5.0+ projects, the quickest way to get started is by using `dotnet new` with Stylet's template.
For .NET Core and .NET 6.0+ projects, the quickest way to get started is by using `dotnet new` with Stylet's template.

Open a command window where you want to create your new project, and install the Stylet templates using:

```
dotnet new -i Stylet.Templates
```

Then create a new .NET 5.0 project with:
Then create a new .NET 6.0 project with:

```
dotnet new stylet -n MyStyletProject
```

(changing `MyStyletProject` as appropriate).

If you want to create a .NET Core 3.1 project, then:

```
dotnet new stylet -F netcoreapp3.1 -n MyStyletProject
```

If you want to set up your project manually, install the [Stylet](https://www.nuget.org/packages/Stylet) package, then follow the instructions in the [Quick Start](https://github.com/canton7/Stylet/wiki/Quick-Start).

Stylet requires .NET 5.0+ or .NET Core 3.0+.
Stylet requires .NET 6.0+.


### .NET Framework (<= .NET 4)
Expand All @@ -59,7 +53,7 @@ See [Quick Start](https://github.com/canton7/Stylet/wiki/Quick-Start) for more d

If you want to set up your project manually, install the [Stylet](https://www.nuget.org/packages/Stylet) package, then follow the instructions in the [Quick Start](https://github.com/canton7/Stylet/wiki/Quick-Start).

Stylet requires .NET 4.5.2 (Visual Studio 2012 or higher).
Stylet requires .NET 4.6.2 (Visual Studio 2013 or higher).


Documentation
Expand Down
5 changes: 2 additions & 3 deletions Stylet.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29021.104
# Visual Studio Version 17
VisualStudioVersion = 17.11.35327.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StyletUnitTests", "StyletUnitTests\StyletUnitTests.csproj", "{13AFA20D-CCEA-4A58-920E-4D8816C7296B}"
EndProject
Expand Down Expand Up @@ -43,7 +43,6 @@ Global
{895A0541-84CF-4D3D-9539-58F1FC286336}.Release|x64.ActiveCfg = Release|Any CPU
{895A0541-84CF-4D3D-9539-58F1FC286336}.Release|x64.Build.0 = Release|Any CPU
{4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|x64.ActiveCfg = Debug|Any CPU
{4122F924-6B71-4DDA-995E-FAF78242E20C}.Debug|x64.Build.0 = Debug|Any CPU
{4122F924-6B71-4DDA-995E-FAF78242E20C}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion Stylet/ConductorBaseWithActiveItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected virtual void ChangeActiveItem(T newItem, bool closePrevious)
ScreenExtensions.TryDeactivate(newItem);
}

this.NotifyOfPropertyChange(nameof(this.ActiveItem));
this.OnPropertyChanged(nameof(this.ActiveItem));
}

/// <summary>
Expand Down
53 changes: 0 additions & 53 deletions Stylet/IValidationAdapter.cs

This file was deleted.

7 changes: 4 additions & 3 deletions Stylet/LabelledValue.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Stylet;

/// <summary>
/// Key-value pair useful for attaching labels to objects and displaying them in the view
/// </summary>
/// <typeparam name="T">Type of the value</typeparam>
public class LabelledValue<T> : PropertyChangedBase, IEquatable<LabelledValue<T>>
public class LabelledValue<T> : ObservableObject, IEquatable<LabelledValue<T>>
{
private string _label;

Expand All @@ -17,7 +18,7 @@ public class LabelledValue<T> : PropertyChangedBase, IEquatable<LabelledValue<T>
public string Label
{
get => this._label;
set => this.SetAndNotify(ref this._label, value);
set => this.SetProperty(ref this._label, value);
}

private T _value;
Expand All @@ -28,7 +29,7 @@ public string Label
public T Value
{
get => this._value;
set => this.SetAndNotify(ref this._value, value);
set => this.SetProperty(ref this._value, value);
}

/// <summary>
Expand Down
96 changes: 0 additions & 96 deletions Stylet/PropertyChangedBase.cs

This file was deleted.

21 changes: 8 additions & 13 deletions Stylet/Screen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,21 @@
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using System.Windows;
using CommunityToolkit.Mvvm.ComponentModel;

namespace Stylet;

/// <summary>
/// Implementation of IScreen. Useful as a base class for your ViewModels
/// </summary>
public class Screen : ValidatingModelBase, IScreen
public class Screen : ObservableValidator, IScreen
{
private readonly ILogger logger;

/// <summary>
/// Initialises a new instance of the <see cref="Screen"/> class, without setting up a validator
/// </summary>
public Screen() : this(null) { }

/// <summary>
/// Initialises a new instance of the <see cref="Screen"/> class, which can validate properties using the given validator
/// </summary>
/// <param name="validator">Validator to use</param>
public Screen(IModelValidator validator) : base(validator)
public Screen()
{
Type type = this.GetType();
this.DisplayName = type.FullName;
Expand All @@ -40,7 +35,7 @@ public Screen(IModelValidator validator) : base(validator)
public string DisplayName
{
get => this._displayName;
set => this.SetAndNotify(ref this._displayName, value);
set => this.SetProperty(ref this._displayName, value);
}

#endregion
Expand All @@ -67,14 +62,14 @@ public virtual ScreenState ScreenState
get => this._screenState;
protected set
{
if (this.SetAndNotify(ref this._screenState, value))
if (this.SetProperty(ref this._screenState, value))
{
// Temporary, until we remove 'State'
#pragma warning disable CS0618 // Type or member is obsolete
this.NotifyOfPropertyChange(nameof(this.State));
this.OnPropertyChanged(nameof(this.State));
#pragma warning restore CS0618 // Type or member is obsolete
}
this.NotifyOfPropertyChange(nameof(this.IsActive));
this.OnPropertyChanged(nameof(this.IsActive));
}
}

Expand Down Expand Up @@ -254,7 +249,7 @@ protected virtual void OnViewLoaded() { }
public object Parent
{
get => this._parent;
set => this.SetAndNotify(ref this._parent, value);
set => this.SetProperty(ref this._parent, value);
}

#endregion
Expand Down
6 changes: 5 additions & 1 deletion Stylet/Stylet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net452;netcoreapp3.0;netcoreapp3.1;net5.0-windows</TargetFrameworks>
<TargetFrameworks>net462;net6.0-windows;net8.0-windows</TargetFrameworks>
<CheckEolTargetFramework>false</CheckEolTargetFramework>
<LangVersion>10</LangVersion>
<UseWPF>true</UseWPF>
Expand Down Expand Up @@ -30,6 +30,10 @@
<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.3.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
<PackageReference Include="System.Drawing.Common" Version="4.7.3" />
</ItemGroup>
Expand Down
Loading