Skip to content

Commit

Permalink
Merge pull request #31 from AvaloniaCommunity/feature/Avalonia-0.11pre4
Browse files Browse the repository at this point in the history
Avalonia v11.0.0-preview4
  • Loading branch information
DamianSuess authored Feb 4, 2023
2 parents c37550c + b2f88c2 commit 14970c4
Show file tree
Hide file tree
Showing 35 changed files with 498 additions and 224 deletions.
15 changes: 11 additions & 4 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@

Change log history for Prism.Avalonia

## v8.1.97.1
## v8.1.97.1 - 2022-12-08

* Fixed: Automatically performs `AutoWireViewModel`
* NEW: Automatically performs `AutoWireViewModel`
* No longer need to device `prism:ViewModelLocator.AutoWireViewModel="True"` in View
* Updated DryIoc to v4.8.0
* Updated to Avalonia v0.10.18
* Fixed unit tests
* Spelling corrections
* Added Sample, Notificiation Pop-up Service

## v8.1.97
## v8.1.97 - 2022-07-14

* Upgraded system to support Prism.Core v8.1.97
* Upgraded to support Prism.Core v8.1.97
* See [[Upgrade-Prism-7.2-to-8.1.md]] for more details

## v7.2.0.1430

* Upgraded to support Prism.Core v7.2.0.1430
16 changes: 8 additions & 8 deletions build/AvaloniaDependency.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.18" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="0.10.18" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.18" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.18" />
<!--<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.18" />-->
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="0.10.18" />
<PackageReference Include="Avalonia.Markup.Xaml.Loader" Version="0.10.18" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.18" />
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0-preview4" />
<!--<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview4" />-->
<PackageReference Include="Avalonia.LinuxFramebuffer" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.Markup.Xaml.Loader" Version="11.0.0-preview4" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview4" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions build/Base.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<Project DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Version>8.1.97.2</Version>
<Version>8.1.97.3-preview.11.4</Version>
<PackageProjectUrl>https://github.com/AvaloniaCommunity/Prism.Avalonia</PackageProjectUrl>
<Copyright>Copyright (c) 2022 Avalonia Community</Copyright>
<Copyright>Copyright (c) 2023 Avalonia Community</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/AvaloniaCommunity/Prism.Avalonia</RepositoryUrl>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion build/BuildTargets.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net5.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0</TargetFrameworks>
</PropertyGroup>

</Project>
1 change: 1 addition & 0 deletions build/SampleApp.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<Import Project="AvaloniaDependency.props" />

<ItemGroup>
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview4" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\src\Prism.DryIoc.Avalonia\Prism.DryIoc.Avalonia.csproj" />
</ItemGroup>

Expand Down
1 change: 0 additions & 1 deletion samples/BootstrapperShellSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Diagnostics;
using Avalonia.Themes.Default;
using Avalonia.Markup.Xaml;
using CommonServiceLocator;
using DryIoc;
Expand Down
2 changes: 1 addition & 1 deletion samples/ModulesSample/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static AppBuilder BuildAvaloniaApp()
})
.With(new Win32PlatformOptions
{
EnableMultitouch = true,
//// EnableMultitouch = true, // Not supported in Avalonia v11.0.0-preview4
AllowEglInitialization = true,
})
.UseSkia()
Expand Down
6 changes: 5 additions & 1 deletion samples/SampleDialogApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { EnableMultiTouch = true, UseDBusMenu = true, })
.With(new Win32PlatformOptions { EnableMultitouch = true, AllowEglInitialization = true, })
.With(new Win32PlatformOptions
{
// EnableMultitouch = true, // Not supported in Avalonia v11.0.0-preview4
AllowEglInitialization = true,
})
.UseSkia()
.LogToTrace();
}
Expand Down
124 changes: 69 additions & 55 deletions samples/SampleMvvmApp/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,90 @@
using System;
using Avalonia;
using Avalonia.Markup.Xaml;
using SampleMvvmApp.ViewModels;
using SampleMvvmApp.Views;
using Prism.DryIoc;
using Prism.Ioc;
using Prism.Modularity;
using Prism.Regions;
using SampleMvvmApp.Services;
using SampleMvvmApp.ViewModels;
using SampleMvvmApp.Views;

namespace SampleMvvmApp;

namespace SampleMvvmApp
/// <summary>
/// Application entry point.
///
/// The methods below are laid out in their order of operation to assist
/// you getting started with Prism.Avalonia.
/// </summary>
public class App : PrismApplication
{
/// <summary>
/// Application entry point.
/// The methods in this file are layed out in their respective calling order
/// to help you learn the order of operation.
/// </summary>
public class App : PrismApplication
/// <summary>App entry point.</summary>
public App()
{
/// <summary>App entry point.</summary>
public App()
{
Console.WriteLine("Constructor()");
}
Console.WriteLine("Constructor()");
}

// Note:
// Though, Prism.WPF v8.1 uses, `protected virtual void Initialize()`
// Avalonia's AppBuilderBase.cs calls, `.Setup() { ... Instance.Initialize(); ... }`
// Therefore, we need this as a `public override void` in PrismApplicationBase.cs
public override void Initialize()
{
Console.WriteLine("Initialize()");
AvaloniaXamlLoader.Load(this);
// Note:
// Though, Prism.WPF v8.1 uses, `protected virtual void Initialize()`
// Avalonia's AppBuilderBase.cs calls, `.Setup() { ... Instance.Initialize(); ... }`
// Therefore, we need this as a `public override void` in PrismApplicationBase.cs
public override void Initialize()
{
Console.WriteLine("Initialize()");
AvaloniaXamlLoader.Load(this);

// DON'T FORGET TO CALL THIS
base.Initialize();
}
// Initializes Prism.Avalonia - DO NOT REMOVE
base.Initialize();
}

/// <summary>Called after Initialize.</summary>
protected override void OnInitialized()
{
// Register Views to the Region it will appear in. Don't register them in the ViewModel.
var regionManager = Container.Resolve<IRegionManager>();
regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView));
regionManager.RegisterViewWithRegion(RegionNames.SidebarRegion, typeof(SidebarView));
/// <summary>Register Services and Views.</summary>
/// <param name="containerRegistry"></param>
protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
Console.WriteLine("RegisterTypes()");

////var logService = Container.Resolve<ILogService>();
////logService.Configure("swlog.config");
}
// Services
containerRegistry.RegisterSingleton<INotificationService, NotificationService>();

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
Console.WriteLine("RegisterTypes()");
// Views - Generic
//// containerRegistry.Register<SidebarView>(); // Not required
//// containerRegistry.Register<MainWindow>();

// Services
containerRegistry.RegisterSingleton<INotificationService, NotificationService>();
// Views - Region Navigation
containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>();
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
containerRegistry.RegisterForNavigation<SubSettingsView, SubSettingsViewModel>();
}

/// <summary>Register optional modules in the catalog.</summary>
/// <param name="moduleCatalog">Module Catalog.</param>
protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
{
base.ConfigureModuleCatalog(moduleCatalog);
}

// Views - Generic
containerRegistry.Register<SidebarView>();
containerRegistry.Register<MainWindow>();
/// <summary>User interface entry point, called after Register and ConfigureModules.</summary>
/// <returns>Startup View.</returns>
protected override IAvaloniaObject CreateShell()
{
Console.WriteLine("CreateShell()");
return Container.Resolve<MainWindow>();
}

/// <summary>Called after Initialize.</summary>
protected override void OnInitialized()
{
// Register Views to the Region it will appear in. Don't register them in the ViewModel.
var regionManager = Container.Resolve<IRegionManager>();

// Views - Region Navigation
containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>();
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
containerRegistry.RegisterForNavigation<SubSettingsView, SubSettingsViewModel>();
}
// WARNING: Prism v11.0.0-prev4
// - DataTemplates MUST define a DataType or else an XAML error will be thrown
// - Error: DataTemplate inside of DataTemplates must have a DataType set
regionManager.RegisterViewWithRegion(RegionNames.ContentRegion, typeof(DashboardView));
regionManager.RegisterViewWithRegion(RegionNames.SidebarRegion, typeof(SidebarView));

/// <summary>User interface entry point, called after Register and ConfigureModules.</summary>
/// <returns>Startup View.</returns>
protected override IAvaloniaObject CreateShell()
{
Console.WriteLine("CreateShell()");
return Container.Resolve<MainWindow>();
}
////var logService = Container.Resolve<ILogService>();
////logService.Configure("swlog.config");
}
}
44 changes: 24 additions & 20 deletions samples/SampleMvvmApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,34 @@
using Avalonia;
using Avalonia.Logging;

namespace SampleMvvmApp
namespace SampleMvvmApp;

public class Program
{
public class Program
public static AppBuilder BuildAvaloniaApp()
{
public static AppBuilder BuildAvaloniaApp()
{
var builder = AppBuilder
.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { EnableMultiTouch = true, UseDBusMenu = true, })
.With(new Win32PlatformOptions { EnableMultitouch = true, AllowEglInitialization = true, })
.UseSkia();
// .UseReactiveUI();
var builder = AppBuilder
.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions { EnableMultiTouch = true, UseDBusMenu = true, })
.With(new Win32PlatformOptions
{
//// EnableMultitouch = true, // In Avalonia v11 this is always enabled
AllowEglInitialization = true,
})
.UseSkia();
// .UseReactiveUI();

#if DEBUG
builder.LogToTrace(LogEventLevel.Debug, LogArea.Property, LogArea.Layout, LogArea.Binding);
builder.LogToTrace(LogEventLevel.Debug, LogArea.Property, LogArea.Layout, LogArea.Binding);
#endif
return builder;
}

// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[ExcludeFromCodeCoverage]
static void Main(string[] args) => BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
return builder;
}

// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[ExcludeFromCodeCoverage]
static void Main(string[] args) =>
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
21 changes: 13 additions & 8 deletions samples/SampleMvvmApp/Views/DashboardView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:prism="http://prismlibrary.com/"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:vm="using:SampleMvvmApp.ViewModels"
x:Class="SampleMvvmApp.Views.DashboardView"
d:DesignHeight="350"
d:DesignWidth="500"
mc:Ignorable="d">

x:CompileBindings="True"
x:DataType="vm:DashboardViewModel"
d:DesignHeight="350" d:DesignWidth="500" mc:Ignorable="d">
<UserControl.Styles>
<!--<Style Selector="Button.cmdBtn">-->
<Style Selector="Button">
<Setter Property="Padding" Value="10" />
<Setter Property="Margin" Value="5" />
Expand Down Expand Up @@ -46,13 +46,18 @@
ScrollViewer.VerticalScrollBarVisibility="Visible"
SelectedIndex="{Binding ListItemSelected}"
SelectionMode="Single">
<ListBox.DataTemplates>
<DataTemplate>
<ListBox.ItemTemplate>
<!--
OLD: <DataTemplate>
NEW: <DataTemplate DataType="{x:Type system:String}">
https://github.com/AvaloniaUI/Avalonia/pull/8221
-->
<DataTemplate DataType="{x:Type system:String}">
<TextBlock Text="{Binding .}"
FontSize="10"
TextWrapping="NoWrap" />
</DataTemplate>
</ListBox.DataTemplates>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</ScrollViewer>
Expand Down
21 changes: 10 additions & 11 deletions samples/SampleMvvmApp/Views/DashboardView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace SampleMvvmApp.Views
namespace SampleMvvmApp.Views;

/// <summary>DashboardView.</summary>
public partial class DashboardView : UserControl
{
/// <summary>DashboardView.</summary>
public partial class DashboardView : UserControl
public DashboardView()
{
public DashboardView()
{
this.InitializeComponent();
}
this.InitializeComponent();
}

private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
12 changes: 5 additions & 7 deletions samples/ViewDiscovery/App.xaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<prism:PrismApplication xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="clr-namespace:Prism.DryIoc;assembly=Prism.DryIoc.Avalonia"
x:Class="ViewDiscovery.App">
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ViewDiscovery.App">
<Application.Styles>
<StyleInclude Source="resm:Avalonia.Themes.Default.DefaultTheme.xaml?assembly=Avalonia.Themes.Default"/>
<StyleInclude Source="resm:Avalonia.Themes.Default.Accents.BaseLight.xaml?assembly=Avalonia.Themes.Default"/>
<FluentTheme Mode="Light" />
</Application.Styles>
</prism:PrismApplication>
</Application>
Loading

0 comments on commit 14970c4

Please sign in to comment.