Skip to content
This repository has been archived by the owner on Nov 4, 2022. It is now read-only.

Commit

Permalink
added support for preview 13 & CommunityToolkit.Mvvm
Browse files Browse the repository at this point in the history
  • Loading branch information
vniehues committed Feb 19, 2022
1 parent 8924926 commit c37e950
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
7 changes: 4 additions & 3 deletions samples/mavvmApp/ViewModels/MainPageViewModel.cs
@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using CommunityToolkit.Mvvm.ComponentModel;
using mavvm;
using Microsoft.Maui.Controls;

namespace mavvmApp.ViewModels
{
public class MainPageViewModel : BindableBase
public class MainPageViewModel : ObservableObject
{
string _title;
public string Title
Expand All @@ -17,15 +18,15 @@ public string Title
}
set
{
SetPropertyValue(ref _title, value);
SetProperty(ref _title, value);
}
}

private int _count;
public int Count
{
get { return this._count; }
set { this.SetPropertyValue(ref this._count, value); }
set { this.SetProperty(ref this._count, value); }
}

public Command CountUpCommand { get; set; }
Expand Down
6 changes: 6 additions & 0 deletions samples/mavvmApp/mavvmApp.csproj
Expand Up @@ -53,6 +53,12 @@
<ItemGroup>
<ProjectReference Include="..\..\src\mavvm\mavvm.csproj" />
</ItemGroup>
<ItemGroup>
<None Remove="CommunityToolkit.Mvvm" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0-preview1" />
</ItemGroup>
<PropertyGroup Condition="$(TargetFramework.Contains('-windows'))">
<OutputType>WinExe</OutputType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
Expand Down
3 changes: 2 additions & 1 deletion src/mavvm/Extensions/MavvmBuilderExtensions.cs
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Hosting;
Expand All @@ -16,7 +17,7 @@ public static class MavvmBuilderExtensions
/// <returns></returns>
public static MauiAppBuilder AddRoute<TView, TViewModel>(this MauiAppBuilder builder)
where TView : ContentPage, new()
where TViewModel : BindableBase
where TViewModel : class, INotifyPropertyChanged
{
var routeName = typeof(TViewModel).Name;
Routing.UnRegisterRoute(routeName);
Expand Down
3 changes: 2 additions & 1 deletion src/mavvm/Factories/MavvmResolveRouteFactory.cs
@@ -1,11 +1,12 @@
using System;
using System.ComponentModel;
using mavvm.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui.Controls;

namespace mavvm
{
public class MavvmResolveRouteFactory<TView, TViewModel> : RouteFactory where TView : ContentPage, new() where TViewModel : BindableBase
public class MavvmResolveRouteFactory<TView, TViewModel> : RouteFactory where TView : ContentPage, new() where TViewModel : class, INotifyPropertyChanged
{

public override Element GetOrCreate(IServiceProvider services)
Expand Down
2 changes: 1 addition & 1 deletion src/mavvm/mavvm.csproj
Expand Up @@ -12,7 +12,7 @@
<SupportedOSPlatformVersion Condition="'$(TargetFramework)' == 'net6.0-android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$(TargetFramework.Contains('-windows'))">10.0.18362.0</SupportedOSPlatformVersion>
<PackageId>mavvm</PackageId>
<PackageVersion>0.9.6</PackageVersion>
<PackageVersion>0.10.1</PackageVersion>
<Authors>Vincent Niehues</Authors>
<Copyright>Vincent Niehues 2021</Copyright>
<Owners>Vincent Niehues</Owners>
Expand Down

0 comments on commit c37e950

Please sign in to comment.