Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avalonia v11 #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project>
<ItemGroup>
<PackageReference Include="Avalonia" Version="11.0.0" />
<PackageReference Include="Avalonia.Desktop" Version="11.0.0" />
<PackageReference Include="Avalonia.Diagnostics" Version="11.0.0" />
<PackageReference Include="Avalonia.Markup.Xaml.Loader" Version="11.0.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.11000" />
<PackageReference Include="Prism.Core" Version="8.1.97" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion Outlookish.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
CodeMaid.config = CodeMaid.config
Directory.Packages.props = Directory.Packages.props
readme.md = readme.md
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp.Services", "SampleApp.Services\SampleApp.Services.csproj", "{1AFDDD2F-2AF5-4BF3-AE04-89A23B2991D3}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleApp.Services", "SampleApp.Services\SampleApp.Services.csproj", "{1AFDDD2F-2AF5-4BF3-AE04-89A23B2991D3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
7 changes: 6 additions & 1 deletion SampleApp.Services/SampleApp.Services.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>11.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia.Themes.Fluent" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\source\SampleApp.Common\SampleApp.Common.csproj" />
</ItemGroup>
Expand Down
12 changes: 7 additions & 5 deletions source/SampleApp.Common/SampleApp.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<BaseOutputPath>..\..\output</BaseOutputPath>
<LangVersion>11.0</LangVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.21" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Prism.DryIoc.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
<PackageReference Include="Prism.DryIoc.Avalonia" />
</ItemGroup>

</Project>
12 changes: 7 additions & 5 deletions source/SampleApp.Common/TabControlAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,23 @@ protected override void Adapt(IRegion region, TabControl regionTarget)
{
var items = regionTarget.Items.Cast<TabItem>().ToList();
items.Add(new TabItem { Header = item.Tag, Content = item });
regionTarget.Items = items; // Avalonia v0.10.x
//// regionTarget.Items.Set(items); // Avalonia v11

//// regionTarget.Items = items; // Avalonia v0.10.x
regionTarget.ItemsSource = items; // Avalonia v11.0
}
}
else if (e.Action == NotifyCollectionChangedAction.Remove)
{
foreach (UserControl item in e.OldItems)
{
var tabToDelete = regionTarget.Items.OfType<TabItem>().FirstOrDefault(n => n.Content == item);
// regionTarget.Items.Remove(tabToDelete); // WPF

// regionTarget.Items.Remove(tabToDelete); // WPF
var items = regionTarget.Items.Cast<TabItem>().ToList();
items.Remove(tabToDelete);
regionTarget.Items = items;
//// regionTarget.Items.Set(items); // Avalonia v11

//// regionTarget.Items = items; // Avalonia v0.10
regionTarget.ItemsSource = items; // Avalonia v11
}
}
};
Expand Down
20 changes: 11 additions & 9 deletions source/SampleApp.Main/App.axaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<prism:PrismApplication xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SampleApp"
xmlns:prism="http://prismlibrary.com/"
x:Class="SampleApp.App">
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:SampleApp"
x:Class="SampleApp.App"
RequestedThemeVariant="Default">

<prism:PrismApplication.Styles>
<!--<prism:PrismApplication.Styles>
<FluentTheme Mode="Light" />
<!--<FluentTheme Mode="Dark" />-->
</prism:PrismApplication.Styles>
</prism:PrismApplication>
</prism:PrismApplication.Styles>-->
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
6 changes: 3 additions & 3 deletions source/SampleApp.Main/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Prism.Ioc;
Expand Down Expand Up @@ -45,7 +45,7 @@ protected override void ConfigureRegionAdapterMappings(RegionAdapterMappings reg
regionAdapterMappings.RegisterMapping(typeof(TabControl), Container.Resolve<TabControlAdapter>());
}

protected override IAvaloniaObject CreateShell()
protected override AvaloniaObject CreateShell()
{
return this.Container.Resolve<MainWindow>();
}
Expand Down Expand Up @@ -75,4 +75,4 @@ protected override void RegisterTypes(IContainerRegistry containerRegistry)
containerRegistry.RegisterForNavigation<DashboardView, DashboardViewModel>();
containerRegistry.RegisterForNavigation<SettingsView, SettingsViewModel>();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia.Controls;
using Avalonia.Controls;
using Prism.Regions;

namespace SampleApp.Main.Core.RegionAdapters
Expand All @@ -16,14 +16,15 @@ protected override void Adapt(IRegion region, Grid regionTarget)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach (IControl item in e.NewItems)
foreach (Control item in e.NewItems)
{
regionTarget.Children.Add(item);
}
}

if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
{
foreach (IControl item in e.OldItems)
foreach (Control item in e.OldItems)
{
regionTarget.Children.Remove(item);
}
Expand All @@ -33,4 +34,4 @@ protected override void Adapt(IRegion region, Grid regionTarget)

protected override IRegion CreateRegion() => new SingleActiveRegion() { };
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Avalonia.Controls;
using Avalonia.Controls;
using Prism.Regions;

namespace SampleApp.Main.Core.RegionAdapters
Expand All @@ -16,7 +16,7 @@ protected override void Adapt(IRegion region, StackPanel regionTarget)
{
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
{
foreach (IControl item in e.NewItems)
foreach (Control item in e.NewItems)
{
if (e.NewItems != null)
regionTarget.Children.Add(item);
Expand All @@ -25,7 +25,7 @@ protected override void Adapt(IRegion region, StackPanel regionTarget)

if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Remove)
{
foreach (IControl item in e.OldItems)
foreach (Control item in e.OldItems)
{
if (e.OldItems != null)
regionTarget.Children.Remove(item);
Expand All @@ -36,4 +36,4 @@ protected override void Adapt(IRegion region, StackPanel regionTarget)

protected override IRegion CreateRegion() => new SingleActiveRegion() { };
}
}
}
5 changes: 1 addition & 4 deletions source/SampleApp.Main/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.ReactiveUI;

namespace SampleApp
Expand All @@ -13,10 +14,6 @@ public static AppBuilder BuildAvaloniaApp() => AppBuilder
EnableMultiTouch = false,
UseDBusMenu = true
})
.With(new Win32PlatformOptions {
EnableMultitouch = true,
AllowEglInitialization = true
})
.UseSkia()
.UseReactiveUI()
.LogToTrace();
Expand Down
16 changes: 9 additions & 7 deletions source/SampleApp.Main/SampleApp.csproj
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Folder Include="Models\" />
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.21" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.21" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.21" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Prism.Core" Version="8.1.97" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
<PackageReference Include="Prism.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SampleApp.Common\SampleApp.Common.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\output</BaseOutputPath>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
Expand All @@ -15,11 +16,12 @@
<None Remove="Models\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.21" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.21" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.21" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SampleApp.Common\SampleApp.Common.csproj" />
Expand Down
8 changes: 4 additions & 4 deletions source/SampleApp.Modules.Calendar/Views/CalendarView.axaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:SampleApp.Modules.Calendar.ViewModels"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand All @@ -7,9 +7,9 @@
x:Class="SampleApp.Modules.Calendar.Views.CalendarView"
prism:ViewModelLocator.AutoWireViewModel="True">

<Design.DataContext>
<vm:CalendarViewViewModel />
</Design.DataContext>
<!--<Design.DataContext>
<vm:CalendarViewModel />
</Design.DataContext>-->

<StackPanel>
<Calendar Name="DisplayDatesCalendar" SelectionMode="SingleDate" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\output</BaseOutputPath>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
Expand All @@ -15,11 +16,12 @@
<None Remove="Models\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.21" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.21" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.21" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SampleApp.Common\SampleApp.Common.csproj" />
Expand Down
14 changes: 8 additions & 6 deletions source/SampleApp.Modules.Mail/SampleApp.Modules.Mail.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>
<BaseOutputPath>..\..\output</BaseOutputPath>
<LangVersion>11.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<AvaloniaResource Include="Assets\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.21" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.21" />
<PackageReference Include="Avalonia.Diagnostics" Version="0.10.21" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.21" />
<PackageReference Include="Prism.Avalonia" Version="8.1.97.1021" />
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Prism.Avalonia" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SampleApp.Services\SampleApp.Services.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions source/SampleApp.Modules.Mail/Views/MailFocusedView.axaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl xmlns="https://github.com/avaloniaui"
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -9,7 +9,7 @@
Tag="Focused"
mc:Ignorable="d">
<ListBox Margin="2"
Items="{Binding MailMessages}"
ItemsSource="{Binding MailMessages}"
ScrollViewer.HorizontalScrollBarVisibility="Visible"
ScrollViewer.VerticalScrollBarVisibility="Visible"
SelectionMode="Single">
Expand Down
Loading