diff --git a/.gitignore b/.gitignore
index 61a3b53de1..bbf358b8f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -210,9 +210,9 @@ coc-settings.json
.ccls-cache
.ccls
*.map
-src/Web/Avalonia.Web.Blazor/wwwroot/*.js
-src/Web/Avalonia.Web.Blazor/Interop/Typescript/*.js
+src/Browser/Avalonia.Browser.Blazor/wwwroot/*.js
+src/Browser/Avalonia.Browser.Blazor/Interop/Typescript/*.js
node_modules
-src/Web/Avalonia.Web.Blazor/webapp/package-lock.json
-src/Web/Avalonia.Web.Blazor/wwwroot
-src/Web/Avalonia.Web/wwwroot
+src/Browser/Avalonia.Browser.Blazor/webapp/package-lock.json
+src/Browser/Avalonia.Browser.Blazor/wwwroot
+src/Browser/Avalonia.Browser/wwwroot
diff --git a/.ncrunch/Avalonia.Web.Blazor.v3.ncrunchproject b/.ncrunch/Avalonia.Benchmarks.v3.ncrunchproject
similarity index 100%
rename from .ncrunch/Avalonia.Web.Blazor.v3.ncrunchproject
rename to .ncrunch/Avalonia.Benchmarks.v3.ncrunchproject
diff --git a/.ncrunch/Avalonia.Web.v3.ncrunchproject b/.ncrunch/Avalonia.Browser.Blazor.v3.ncrunchproject
similarity index 100%
rename from .ncrunch/Avalonia.Web.v3.ncrunchproject
rename to .ncrunch/Avalonia.Browser.Blazor.v3.ncrunchproject
diff --git a/.ncrunch/ControlCatalog.Blazor.Web.v3.ncrunchproject b/.ncrunch/Avalonia.Browser.v3.ncrunchproject
similarity index 100%
rename from .ncrunch/ControlCatalog.Blazor.Web.v3.ncrunchproject
rename to .ncrunch/Avalonia.Browser.v3.ncrunchproject
diff --git a/.ncrunch/ControlCatalog.Web.v3.ncrunchproject b/.ncrunch/Avalonia.Designer.HostApp.v3.ncrunchproject
similarity index 100%
rename from .ncrunch/ControlCatalog.Web.v3.ncrunchproject
rename to .ncrunch/Avalonia.Designer.HostApp.v3.ncrunchproject
diff --git a/.ncrunch/Avalonia.Themes.Fluent.net6.0.v3.ncrunchproject b/.ncrunch/Avalonia.Themes.Fluent.net6.0.v3.ncrunchproject
new file mode 100644
index 0000000000..02eb0d211e
--- /dev/null
+++ b/.ncrunch/Avalonia.Themes.Fluent.net6.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ False
+
+
\ No newline at end of file
diff --git a/.ncrunch/Avalonia.Themes.Fluent.netstandard2.0.v3.ncrunchproject b/.ncrunch/Avalonia.Themes.Fluent.netstandard2.0.v3.ncrunchproject
new file mode 100644
index 0000000000..02eb0d211e
--- /dev/null
+++ b/.ncrunch/Avalonia.Themes.Fluent.netstandard2.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ False
+
+
\ No newline at end of file
diff --git a/.ncrunch/Avalonia.Themes.Simple.net6.0.v3.ncrunchproject b/.ncrunch/Avalonia.Themes.Simple.net6.0.v3.ncrunchproject
new file mode 100644
index 0000000000..02eb0d211e
--- /dev/null
+++ b/.ncrunch/Avalonia.Themes.Simple.net6.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ False
+
+
\ No newline at end of file
diff --git a/.ncrunch/Avalonia.Themes.Simple.netstandard2.0.v3.ncrunchproject b/.ncrunch/Avalonia.Themes.Simple.netstandard2.0.v3.ncrunchproject
new file mode 100644
index 0000000000..02eb0d211e
--- /dev/null
+++ b/.ncrunch/Avalonia.Themes.Simple.netstandard2.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ False
+
+
\ No newline at end of file
diff --git a/.ncrunch/ControlCatalog.Browser.Blazor.v3.ncrunchproject b/.ncrunch/ControlCatalog.Browser.Blazor.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/ControlCatalog.Browser.Blazor.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/ControlCatalog.Browser.v3.ncrunchproject b/.ncrunch/ControlCatalog.Browser.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/ControlCatalog.Browser.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/MobileSandbox.v3.ncrunchproject b/.ncrunch/MobileSandbox.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/MobileSandbox.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/Avalonia.sln b/Avalonia.sln
index e2f04ddc35..34b5596119 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -198,9 +198,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTestApp", "sampl
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.IntegrationTests.Appium", "tests\Avalonia.IntegrationTests.Appium\Avalonia.IntegrationTests.Appium.csproj", "{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}"
EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Web", "Web", "{86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Web.Blazor", "src\Web\Avalonia.Web.Blazor\Avalonia.Web.Blazor.csproj", "{25831348-EB2A-483E-9576-E8F6528674A5}"
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Browser", "Browser", "{86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WindowsInteropTest", "samples\interop\WindowsInteropTest\WindowsInteropTest.csproj", "{26A98DA1-D89D-4A95-8152-349F404DA2E2}"
EndProject
@@ -216,8 +214,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.DesignerSupport.Te
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevGenerators", "src\tools\DevGenerators\DevGenerators.csproj", "{1BBFAD42-B99E-47E0-B00A-A4BC6B6BB4BB}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.Web", "src\Web\Avalonia.Web\Avalonia.Web.csproj", "{76D39FF6-6B4F-46C4-93CD-E6FC4665739E}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MobileSandbox", "samples\MobileSandbox\MobileSandbox.csproj", "{3B8519C1-2F51-4F12-A348-120AB91D4532}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MobileSandbox.Android", "samples\MobileSandbox.Android\MobileSandbox.Android.csproj", "{C90FE60B-B01E-4F35-91D6-379D6966030F}"
@@ -226,9 +222,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MobileSandbox.iOS", "sample
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MobileSandbox.Desktop", "samples\MobileSandbox.Desktop\MobileSandbox.Desktop.csproj", "{62D392C9-81CF-487F-92E8-598B2AF3FDCE}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Blazor.Web", "samples\ControlCatalog.Blazor.Web\ControlCatalog.Blazor.Web.csproj", "{6A710364-AE6D-40BD-968B-024311527AC2}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Browser", "src\Browser\Avalonia.Browser\Avalonia.Browser.csproj", "{4A39637C-9338-4925-A4DB-D072E292EC78}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Browser.Blazor", "src\Browser\Avalonia.Browser.Blazor\Avalonia.Browser.Blazor.csproj", "{47F8530C-F19B-4B1A-B4D6-EB231522AE5D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Browser", "samples\ControlCatalog.Browser\ControlCatalog.Browser.csproj", "{15B93A4C-1B46-43F6-B534-7B25B6E99932}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Web", "samples\ControlCatalog.Web\ControlCatalog.Web.csproj", "{8B3E8405-DE18-4048-A459-9CA4AC3319A2}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Browser.Blazor", "samples\ControlCatalog.Browser.Blazor\ControlCatalog.Browser.Blazor.csproj", "{90B08091-9BBD-4362-B712-E9F2CC62B218}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -480,10 +480,6 @@ Global
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A}.Release|Any CPU.Build.0 = Release|Any CPU
- {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {25831348-EB2A-483E-9576-E8F6528674A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {25831348-EB2A-483E-9576-E8F6528674A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {25831348-EB2A-483E-9576-E8F6528674A5}.Release|Any CPU.Build.0 = Release|Any CPU
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{26A98DA1-D89D-4A95-8152-349F404DA2E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -512,10 +508,6 @@ Global
{1BBFAD42-B99E-47E0-B00A-A4BC6B6BB4BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BBFAD42-B99E-47E0-B00A-A4BC6B6BB4BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1BBFAD42-B99E-47E0-B00A-A4BC6B6BB4BB}.Release|Any CPU.Build.0 = Release|Any CPU
- {76D39FF6-6B4F-46C4-93CD-E6FC4665739E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {76D39FF6-6B4F-46C4-93CD-E6FC4665739E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {76D39FF6-6B4F-46C4-93CD-E6FC4665739E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {76D39FF6-6B4F-46C4-93CD-E6FC4665739E}.Release|Any CPU.Build.0 = Release|Any CPU
{3B8519C1-2F51-4F12-A348-120AB91D4532}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B8519C1-2F51-4F12-A348-120AB91D4532}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B8519C1-2F51-4F12-A348-120AB91D4532}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -533,14 +525,22 @@ Global
{62D392C9-81CF-487F-92E8-598B2AF3FDCE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{62D392C9-81CF-487F-92E8-598B2AF3FDCE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{62D392C9-81CF-487F-92E8-598B2AF3FDCE}.Release|Any CPU.Build.0 = Release|Any CPU
- {6A710364-AE6D-40BD-968B-024311527AC2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6A710364-AE6D-40BD-968B-024311527AC2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6A710364-AE6D-40BD-968B-024311527AC2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6A710364-AE6D-40BD-968B-024311527AC2}.Release|Any CPU.Build.0 = Release|Any CPU
- {8B3E8405-DE18-4048-A459-9CA4AC3319A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {8B3E8405-DE18-4048-A459-9CA4AC3319A2}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {8B3E8405-DE18-4048-A459-9CA4AC3319A2}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {8B3E8405-DE18-4048-A459-9CA4AC3319A2}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4A39637C-9338-4925-A4DB-D072E292EC78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4A39637C-9338-4925-A4DB-D072E292EC78}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4A39637C-9338-4925-A4DB-D072E292EC78}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4A39637C-9338-4925-A4DB-D072E292EC78}.Release|Any CPU.Build.0 = Release|Any CPU
+ {47F8530C-F19B-4B1A-B4D6-EB231522AE5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {47F8530C-F19B-4B1A-B4D6-EB231522AE5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {47F8530C-F19B-4B1A-B4D6-EB231522AE5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {47F8530C-F19B-4B1A-B4D6-EB231522AE5D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {15B93A4C-1B46-43F6-B534-7B25B6E99932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {15B93A4C-1B46-43F6-B534-7B25B6E99932}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {15B93A4C-1B46-43F6-B534-7B25B6E99932}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {15B93A4C-1B46-43F6-B534-7B25B6E99932}.Release|Any CPU.Build.0 = Release|Any CPU
+ {90B08091-9BBD-4362-B712-E9F2CC62B218}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {90B08091-9BBD-4362-B712-E9F2CC62B218}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {90B08091-9BBD-4362-B712-E9F2CC62B218}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {90B08091-9BBD-4362-B712-E9F2CC62B218}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -591,20 +591,20 @@ Global
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{676D6BFD-029D-4E43-BFC7-3892265CE251} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{F2CE566B-E7F6-447A-AB1A-3F574A6FE43A} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
- {25831348-EB2A-483E-9576-E8F6528674A5} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
{26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
{A0D0A6A4-5C72-4ADA-9B27-621C7D94F270} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{70B9F5CC-E2F9-4314-9514-EDE762ACCC4B} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{2B390431-288C-435C-BB6B-A374033BD8D1} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637}
{EABE2161-989B-42BF-BD8D-1E34B20C21F1} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
{1BBFAD42-B99E-47E0-B00A-A4BC6B6BB4BB} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637}
- {76D39FF6-6B4F-46C4-93CD-E6FC4665739E} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
{3B8519C1-2F51-4F12-A348-120AB91D4532} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{C90FE60B-B01E-4F35-91D6-379D6966030F} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{FED9A71D-00D7-4F40-A9E4-1229EEA28EEB} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{62D392C9-81CF-487F-92E8-598B2AF3FDCE} = {9B9E3891-2366-4253-A952-D08BCEB71098}
- {6A710364-AE6D-40BD-968B-024311527AC2} = {9B9E3891-2366-4253-A952-D08BCEB71098}
- {8B3E8405-DE18-4048-A459-9CA4AC3319A2} = {9B9E3891-2366-4253-A952-D08BCEB71098}
+ {4A39637C-9338-4925-A4DB-D072E292EC78} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
+ {47F8530C-F19B-4B1A-B4D6-EB231522AE5D} = {86A3F706-DC3C-43C6-BE1B-B98F5BAAA268}
+ {15B93A4C-1B46-43F6-B534-7B25B6E99932} = {9B9E3891-2366-4253-A952-D08BCEB71098}
+ {90B08091-9BBD-4362-B712-E9F2CC62B218} = {9B9E3891-2366-4253-A952-D08BCEB71098}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A}
diff --git a/packages/Avalonia/AvaloniaBuildTasks.targets b/packages/Avalonia/AvaloniaBuildTasks.targets
index 01bf303a20..4f9c4d7720 100644
--- a/packages/Avalonia/AvaloniaBuildTasks.targets
+++ b/packages/Avalonia/AvaloniaBuildTasks.targets
@@ -99,6 +99,7 @@
AssemblyFile="@(IntermediateAssembly)"
ReferencesFilePath="$(AvaloniaXamlReferencesTemporaryFilePath)"
OriginalCopyPath="$(AvaloniaXamlOriginalCopyFilePath)"
+ RefAssemblyFile="@(IntermediateRefAssembly)"
ProjectDirectory="$(MSBuildProjectDirectory)"
VerifyIl="$(AvaloniaXamlIlVerifyIl)"
ReportImportance="$(AvaloniaXamlReportImportance)"
diff --git a/samples/ControlCatalog.Blazor.Web/App.razor b/samples/ControlCatalog.Browser.Blazor/App.razor
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/App.razor
rename to samples/ControlCatalog.Browser.Blazor/App.razor
diff --git a/samples/ControlCatalog.Blazor.Web/App.razor.cs b/samples/ControlCatalog.Browser.Blazor/App.razor.cs
similarity index 83%
rename from samples/ControlCatalog.Blazor.Web/App.razor.cs
rename to samples/ControlCatalog.Browser.Blazor/App.razor.cs
index 8cc0095f20..f38db2b055 100644
--- a/samples/ControlCatalog.Blazor.Web/App.razor.cs
+++ b/samples/ControlCatalog.Browser.Blazor/App.razor.cs
@@ -1,7 +1,7 @@
using Avalonia;
-using Avalonia.Web.Blazor;
+using Avalonia.Browser.Blazor;
-namespace ControlCatalog.Blazor.Web;
+namespace ControlCatalog.Browser.Blazor;
public partial class App
{
diff --git a/samples/ControlCatalog.Blazor.Web/ControlCatalog.Blazor.Web.csproj b/samples/ControlCatalog.Browser.Blazor/ControlCatalog.Browser.Blazor.csproj
similarity index 79%
rename from samples/ControlCatalog.Blazor.Web/ControlCatalog.Blazor.Web.csproj
rename to samples/ControlCatalog.Browser.Blazor/ControlCatalog.Browser.Blazor.csproj
index 03fb31f0d3..d0fb614840 100644
--- a/samples/ControlCatalog.Blazor.Web/ControlCatalog.Blazor.Web.csproj
+++ b/samples/ControlCatalog.Browser.Blazor/ControlCatalog.Browser.Blazor.csproj
@@ -15,15 +15,15 @@
-
+
-
-
+
+
diff --git a/samples/ControlCatalog.Blazor.Web/Pages/Index.razor b/samples/ControlCatalog.Browser.Blazor/Pages/Index.razor
similarity index 50%
rename from samples/ControlCatalog.Blazor.Web/Pages/Index.razor
rename to samples/ControlCatalog.Browser.Blazor/Pages/Index.razor
index 93ca07f9f1..7480e4c5e9 100644
--- a/samples/ControlCatalog.Blazor.Web/Pages/Index.razor
+++ b/samples/ControlCatalog.Browser.Blazor/Pages/Index.razor
@@ -1,5 +1,5 @@
@page "/"
-@using Avalonia.Web.Blazor
+@using Avalonia.Browser.Blazor
diff --git a/samples/ControlCatalog.Blazor.Web/Program.cs b/samples/ControlCatalog.Browser.Blazor/Program.cs
similarity index 94%
rename from samples/ControlCatalog.Blazor.Web/Program.cs
rename to samples/ControlCatalog.Browser.Blazor/Program.cs
index d71b125fa1..eb99ca518e 100644
--- a/samples/ControlCatalog.Blazor.Web/Program.cs
+++ b/samples/ControlCatalog.Browser.Blazor/Program.cs
@@ -3,7 +3,7 @@ using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.DependencyInjection;
-using ControlCatalog.Blazor.Web;
+using ControlCatalog.Browser.Blazor;
public class Program
{
diff --git a/samples/ControlCatalog.Blazor.Web/Properties/launchSettings.json b/samples/ControlCatalog.Browser.Blazor/Properties/launchSettings.json
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/Properties/launchSettings.json
rename to samples/ControlCatalog.Browser.Blazor/Properties/launchSettings.json
diff --git a/samples/ControlCatalog.Blazor.Web/Shared/MainLayout.razor b/samples/ControlCatalog.Browser.Blazor/Shared/MainLayout.razor
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/Shared/MainLayout.razor
rename to samples/ControlCatalog.Browser.Blazor/Shared/MainLayout.razor
diff --git a/samples/ControlCatalog.Blazor.Web/_Imports.razor b/samples/ControlCatalog.Browser.Blazor/_Imports.razor
similarity index 88%
rename from samples/ControlCatalog.Blazor.Web/_Imports.razor
rename to samples/ControlCatalog.Browser.Blazor/_Imports.razor
index 0e6d11b419..dc4f778352 100644
--- a/samples/ControlCatalog.Blazor.Web/_Imports.razor
+++ b/samples/ControlCatalog.Browser.Blazor/_Imports.razor
@@ -6,5 +6,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.AspNetCore.Components.WebAssembly.Http
@using Microsoft.JSInterop
-@using ControlCatalog.Blazor.Web.Shared
+@using ControlCatalog.Browser.Blazor.Shared
@using SkiaSharp
diff --git a/samples/ControlCatalog.Blazor.Web/wwwroot/css/app.css b/samples/ControlCatalog.Browser.Blazor/wwwroot/css/app.css
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/wwwroot/css/app.css
rename to samples/ControlCatalog.Browser.Blazor/wwwroot/css/app.css
diff --git a/samples/ControlCatalog.Blazor.Web/wwwroot/favicon.ico b/samples/ControlCatalog.Browser.Blazor/wwwroot/favicon.ico
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/wwwroot/favicon.ico
rename to samples/ControlCatalog.Browser.Blazor/wwwroot/favicon.ico
diff --git a/samples/ControlCatalog.Blazor.Web/wwwroot/index.html b/samples/ControlCatalog.Browser.Blazor/wwwroot/index.html
similarity index 100%
rename from samples/ControlCatalog.Blazor.Web/wwwroot/index.html
rename to samples/ControlCatalog.Browser.Blazor/wwwroot/index.html
diff --git a/samples/ControlCatalog.Web/ControlCatalog.Web.csproj b/samples/ControlCatalog.Browser/ControlCatalog.Browser.csproj
similarity index 85%
rename from samples/ControlCatalog.Web/ControlCatalog.Web.csproj
rename to samples/ControlCatalog.Browser/ControlCatalog.Browser.csproj
index 06a5466619..c4278459f3 100644
--- a/samples/ControlCatalog.Web/ControlCatalog.Web.csproj
+++ b/samples/ControlCatalog.Browser/ControlCatalog.Browser.csproj
@@ -26,7 +26,7 @@
-
+
@@ -39,6 +39,6 @@
-
-
+
+
diff --git a/samples/ControlCatalog.Web/EmbedSample.Browser.cs b/samples/ControlCatalog.Browser/EmbedSample.Browser.cs
similarity index 95%
rename from samples/ControlCatalog.Web/EmbedSample.Browser.cs
rename to samples/ControlCatalog.Browser/EmbedSample.Browser.cs
index 5cfbb608cc..c367230ddf 100644
--- a/samples/ControlCatalog.Web/EmbedSample.Browser.cs
+++ b/samples/ControlCatalog.Browser/EmbedSample.Browser.cs
@@ -1,11 +1,11 @@
using System;
using System.Runtime.InteropServices.JavaScript;
using Avalonia.Platform;
-using Avalonia.Web;
+using Avalonia.Browser;
using ControlCatalog.Pages;
-namespace ControlCatalog.Web;
+namespace ControlCatalog.Browser;
public class EmbedSampleWeb : INativeDemoControl
{
diff --git a/samples/ControlCatalog.Web/Logo.svg b/samples/ControlCatalog.Browser/Logo.svg
similarity index 100%
rename from samples/ControlCatalog.Web/Logo.svg
rename to samples/ControlCatalog.Browser/Logo.svg
diff --git a/samples/ControlCatalog.Web/Program.cs b/samples/ControlCatalog.Browser/Program.cs
similarity index 90%
rename from samples/ControlCatalog.Web/Program.cs
rename to samples/ControlCatalog.Browser/Program.cs
index 7d05c8e462..53b7c60a6f 100644
--- a/samples/ControlCatalog.Web/Program.cs
+++ b/samples/ControlCatalog.Browser/Program.cs
@@ -1,8 +1,8 @@
using System.Runtime.Versioning;
using Avalonia;
-using Avalonia.Web;
+using Avalonia.Browser;
using ControlCatalog;
-using ControlCatalog.Web;
+using ControlCatalog.Browser;
[assembly:SupportedOSPlatform("browser")]
diff --git a/samples/ControlCatalog.Web/Roots.xml b/samples/ControlCatalog.Browser/Roots.xml
similarity index 100%
rename from samples/ControlCatalog.Web/Roots.xml
rename to samples/ControlCatalog.Browser/Roots.xml
diff --git a/samples/ControlCatalog.Web/app.css b/samples/ControlCatalog.Browser/app.css
similarity index 100%
rename from samples/ControlCatalog.Web/app.css
rename to samples/ControlCatalog.Browser/app.css
diff --git a/samples/ControlCatalog.Web/embed.js b/samples/ControlCatalog.Browser/embed.js
similarity index 100%
rename from samples/ControlCatalog.Web/embed.js
rename to samples/ControlCatalog.Browser/embed.js
diff --git a/samples/ControlCatalog.Web/favicon.ico b/samples/ControlCatalog.Browser/favicon.ico
similarity index 100%
rename from samples/ControlCatalog.Web/favicon.ico
rename to samples/ControlCatalog.Browser/favicon.ico
diff --git a/samples/ControlCatalog.Web/index.html b/samples/ControlCatalog.Browser/index.html
similarity index 100%
rename from samples/ControlCatalog.Web/index.html
rename to samples/ControlCatalog.Browser/index.html
diff --git a/samples/ControlCatalog.Web/main.js b/samples/ControlCatalog.Browser/main.js
similarity index 100%
rename from samples/ControlCatalog.Web/main.js
rename to samples/ControlCatalog.Browser/main.js
diff --git a/samples/ControlCatalog.Web/runtimeconfig.template.json b/samples/ControlCatalog.Browser/runtimeconfig.template.json
similarity index 100%
rename from samples/ControlCatalog.Web/runtimeconfig.template.json
rename to samples/ControlCatalog.Browser/runtimeconfig.template.json
diff --git a/samples/ControlCatalog/App.xaml b/samples/ControlCatalog/App.xaml
index 5570ada27b..8f32fa01dd 100644
--- a/samples/ControlCatalog/App.xaml
+++ b/samples/ControlCatalog/App.xaml
@@ -9,6 +9,15 @@
+
+
+
+
+
+
+
+
+
diff --git a/samples/ControlCatalog/App.xaml.cs b/samples/ControlCatalog/App.xaml.cs
index 750c1082a6..6c99eb5289 100644
--- a/samples/ControlCatalog/App.xaml.cs
+++ b/samples/ControlCatalog/App.xaml.cs
@@ -3,85 +3,46 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
-using Avalonia.Markup.Xaml.Styling;
using Avalonia.Styling;
using Avalonia.Themes.Simple;
using Avalonia.Themes.Fluent;
+using ControlCatalog.Models;
using ControlCatalog.ViewModels;
namespace ControlCatalog
{
public class App : Application
{
+ private readonly Styles _themeStylesContainer = new();
+ private FluentTheme? _fluentTheme;
+ private SimpleTheme? _simpleTheme;
+ private IResourceDictionary? _fluentBaseLightColors, _fluentBaseDarkColors;
+ private IStyle? _colorPickerFluent, _colorPickerSimple;
+ private IStyle? _dataGridFluent, _dataGridSimple;
+
public App()
{
DataContext = new ApplicationViewModel();
}
- public static readonly StyleInclude ColorPickerFluent = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
- {
- Source = new Uri("avares://Avalonia.Controls.ColorPicker/Themes/Fluent/Fluent.xaml")
- };
-
- public static readonly StyleInclude ColorPickerSimple = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
- {
- Source = new Uri("avares://Avalonia.Controls.ColorPicker/Themes/Simple/Simple.xaml")
- };
-
- public static readonly StyleInclude DataGridFluent = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
- {
- Source = new Uri("avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml")
- };
-
- public static readonly StyleInclude DataGridSimple = new StyleInclude(new Uri("avares://ControlCatalog/Styles"))
- {
- Source = new Uri("avares://Avalonia.Controls.DataGrid/Themes/Simple.xaml")
- };
-
- public static FluentTheme Fluent = new FluentTheme(new Uri("avares://ControlCatalog/Styles"));
-
- public static SimpleTheme Simple = new SimpleTheme(new Uri("avares://ControlCatalog/Styles"));
-
- public static Styles SimpleLight = new Styles
- {
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml")
- },
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/Base.xaml")
- },
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/BaseLight.xaml")
- },
- Simple
- };
-
- public static Styles SimpleDark = new Styles
- {
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/AccentColors.xaml")
- },
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/Base.xaml")
- },
- new StyleInclude(new Uri("resm:Styles?assembly=ControlCatalog"))
- {
- Source = new Uri("avares://Avalonia.Themes.Fluent/Accents/BaseDark.xaml")
- },
- Simple
- };
-
public override void Initialize()
{
- Styles.Insert(0, Fluent);
- Styles.Insert(1, ColorPickerFluent);
- Styles.Insert(2, DataGridFluent);
+ Styles.Add(_themeStylesContainer);
+
AvaloniaXamlLoader.Load(this);
+
+ _fluentTheme = new FluentTheme();
+ _simpleTheme = new SimpleTheme();
+ _simpleTheme.Resources.MergedDictionaries.Add((IResourceDictionary)Resources["FluentAccentColors"]!);
+ _simpleTheme.Resources.MergedDictionaries.Add((IResourceDictionary)Resources["FluentBaseColors"]!);
+ _colorPickerFluent = (IStyle)Resources["ColorPickerFluent"]!;
+ _colorPickerSimple = (IStyle)Resources["ColorPickerSimple"]!;
+ _dataGridFluent = (IStyle)Resources["DataGridFluent"]!;
+ _dataGridSimple = (IStyle)Resources["DataGridSimple"]!;
+ _fluentBaseLightColors = (IResourceDictionary)Resources["FluentBaseLightColors"]!;
+ _fluentBaseDarkColors = (IResourceDictionary)Resources["FluentBaseDarkColors"]!;
+
+ SetThemeVariant(CatalogTheme.FluentLight);
}
public override void OnFrameworkInitializationCompleted()
@@ -97,5 +58,78 @@ namespace ControlCatalog
base.OnFrameworkInitializationCompleted();
}
+
+ private CatalogTheme _prevTheme;
+ public static CatalogTheme CurrentTheme => ((App)Current!)._prevTheme;
+ public static void SetThemeVariant(CatalogTheme theme)
+ {
+ var app = (App)Current!;
+ var prevTheme = app._prevTheme;
+ app._prevTheme = theme;
+ var shouldReopenWindow = theme switch
+ {
+ CatalogTheme.FluentLight => prevTheme is CatalogTheme.SimpleDark or CatalogTheme.SimpleLight,
+ CatalogTheme.FluentDark => prevTheme is CatalogTheme.SimpleDark or CatalogTheme.SimpleLight,
+ CatalogTheme.SimpleLight => prevTheme is CatalogTheme.FluentDark or CatalogTheme.FluentLight,
+ CatalogTheme.SimpleDark => prevTheme is CatalogTheme.FluentDark or CatalogTheme.FluentLight,
+ _ => throw new ArgumentOutOfRangeException(nameof(theme), theme, null)
+ };
+
+ if (app._themeStylesContainer.Count == 0)
+ {
+ app._themeStylesContainer.Add(new Style());
+ app._themeStylesContainer.Add(new Style());
+ app._themeStylesContainer.Add(new Style());
+ }
+
+ if (theme == CatalogTheme.FluentLight)
+ {
+ app._fluentTheme!.Mode = FluentThemeMode.Light;
+ app._themeStylesContainer[0] = app._fluentTheme;
+ app._themeStylesContainer[1] = app._colorPickerFluent!;
+ app._themeStylesContainer[2] = app._dataGridFluent!;
+ }
+ else if (theme == CatalogTheme.FluentDark)
+ {
+ app._fluentTheme!.Mode = FluentThemeMode.Dark;
+ app._themeStylesContainer[0] = app._fluentTheme;
+ app._themeStylesContainer[1] = app._colorPickerFluent!;
+ app._themeStylesContainer[2] = app._dataGridFluent!;
+ }
+ else if (theme == CatalogTheme.SimpleLight)
+ {
+ app._simpleTheme!.Mode = SimpleThemeMode.Light;
+ app._simpleTheme.Resources.MergedDictionaries.Remove(app._fluentBaseDarkColors!);
+ app._simpleTheme.Resources.MergedDictionaries.Add(app._fluentBaseLightColors!);
+ app._themeStylesContainer[0] = app._simpleTheme;
+ app._themeStylesContainer[1] = app._colorPickerSimple!;
+ app._themeStylesContainer[2] = app._dataGridSimple!;
+ }
+ else if (theme == CatalogTheme.SimpleDark)
+ {
+ app._simpleTheme!.Mode = SimpleThemeMode.Dark;
+ app._simpleTheme.Resources.MergedDictionaries.Remove(app._fluentBaseLightColors!);
+ app._simpleTheme.Resources.MergedDictionaries.Add(app._fluentBaseDarkColors!);
+ app._themeStylesContainer[0] = app._simpleTheme;
+ app._themeStylesContainer[1] = app._colorPickerSimple!;
+ app._themeStylesContainer[2] = app._dataGridSimple!;
+ }
+
+ if (shouldReopenWindow)
+ {
+ if (app.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime)
+ {
+ var oldWindow = desktopLifetime.MainWindow;
+ var newWindow = new MainWindow();
+ desktopLifetime.MainWindow = newWindow;
+ newWindow.Show();
+ oldWindow?.Close();
+ }
+ else if (app.ApplicationLifetime is ISingleViewApplicationLifetime singleViewLifetime)
+ {
+ singleViewLifetime.MainView = new MainView();
+ }
+ }
+ }
}
}
diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs
index 7001eb41ea..15e666ae7b 100644
--- a/samples/ControlCatalog/MainView.xaml.cs
+++ b/samples/ControlCatalog/MainView.xaml.cs
@@ -6,7 +6,6 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Media.Immutable;
-using Avalonia.Themes.Fluent;
using ControlCatalog.Models;
using ControlCatalog.Pages;
@@ -31,46 +30,12 @@ namespace ControlCatalog
}
var themes = this.Get("Themes");
+ themes.SelectedItem = App.CurrentTheme;
themes.SelectionChanged += (sender, e) =>
{
if (themes.SelectedItem is CatalogTheme theme)
{
- var themeStyle = Application.Current!.Styles[0];
- if (theme == CatalogTheme.FluentLight)
- {
- if (App.Fluent.Mode != FluentThemeMode.Light)
- {
- App.Fluent.Mode = FluentThemeMode.Light;
- }
- Application.Current.Styles[0] = App.Fluent;
- Application.Current.Styles[1] = App.ColorPickerFluent;
- Application.Current.Styles[2] = App.DataGridFluent;
- }
- else if (theme == CatalogTheme.FluentDark)
- {
-
- if (App.Fluent.Mode != FluentThemeMode.Dark)
- {
- App.Fluent.Mode = FluentThemeMode.Dark;
- }
- Application.Current.Styles[0] = App.Fluent;
- Application.Current.Styles[1] = App.ColorPickerFluent;
- Application.Current.Styles[2] = App.DataGridFluent;
- }
- else if (theme == CatalogTheme.SimpleLight)
- {
- App.Simple.Mode = Avalonia.Themes.Simple.SimpleThemeMode.Light;
- Application.Current.Styles[0] = App.SimpleLight;
- Application.Current.Styles[1] = App.ColorPickerSimple;
- Application.Current.Styles[2] = App.DataGridSimple;
- }
- else if (theme == CatalogTheme.SimpleDark)
- {
- App.Simple.Mode = Avalonia.Themes.Simple.SimpleThemeMode.Dark;
- Application.Current.Styles[0] = App.SimpleDark;
- Application.Current.Styles[1] = App.ColorPickerSimple;
- Application.Current.Styles[2] = App.DataGridSimple;
- }
+ App.SetThemeVariant(theme);
}
};
diff --git a/samples/ControlCatalog/Pages/DataGridPage.xaml b/samples/ControlCatalog/Pages/DataGridPage.xaml
index f1fcd8035a..4c3c211ca5 100644
--- a/samples/ControlCatalog/Pages/DataGridPage.xaml
+++ b/samples/ControlCatalog/Pages/DataGridPage.xaml
@@ -14,22 +14,6 @@
-
-
-
-
-
-
A control for displaying and interacting with a data source.
@@ -45,8 +29,7 @@
+ RowBackground="#1000">
@@ -59,6 +42,24 @@
IsVisible="{Binding #ShowGDP.IsChecked}"
x:DataType="local:Country" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -71,6 +72,20 @@
+
+
+
+
+
+
+
+
diff --git a/samples/ControlCatalog/Pages/ListBoxPage.xaml b/samples/ControlCatalog/Pages/ListBoxPage.xaml
index 04129cb82d..dc0eaf0a51 100644
--- a/samples/ControlCatalog/Pages/ListBoxPage.xaml
+++ b/samples/ControlCatalog/Pages/ListBoxPage.xaml
@@ -32,6 +32,7 @@
diff --git a/samples/ControlCatalog/Pages/TabControlPage.xaml b/samples/ControlCatalog/Pages/TabControlPage.xaml
index a830ce69ac..e289de90f9 100644
--- a/samples/ControlCatalog/Pages/TabControlPage.xaml
+++ b/samples/ControlCatalog/Pages/TabControlPage.xaml
@@ -53,14 +53,8 @@
-
-
-
-
-
-
diff --git a/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs b/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
index 59489ebcc0..f89d9d1e20 100644
--- a/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Reactive;
using Avalonia.Controls;
using Avalonia.Controls.Selection;
+using ControlCatalog.Pages;
using MiniMvvm;
namespace ControlCatalog.ViewModels
@@ -20,9 +21,9 @@ namespace ControlCatalog.ViewModels
public ListBoxPageViewModel()
{
- Items = new ObservableCollection(Enumerable.Range(1, 10000).Select(i => GenerateItem()));
+ Items = new ObservableCollection(Enumerable.Range(1, 10000).Select(i => GenerateItem()));
- Selection = new SelectionModel();
+ Selection = new SelectionModel();
Selection.Select(1);
_selectionMode = this.WhenAnyValue(
@@ -58,8 +59,8 @@ namespace ControlCatalog.ViewModels
});
}
- public ObservableCollection Items { get; }
- public SelectionModel Selection { get; }
+ public ObservableCollection Items { get; }
+ public SelectionModel Selection { get; }
public IObservable SelectionMode => _selectionMode;
public bool Multiple
@@ -96,6 +97,31 @@ namespace ControlCatalog.ViewModels
public MiniCommand RemoveItemCommand { get; }
public MiniCommand SelectRandomItemCommand { get; }
- private string GenerateItem() => $"Item {_counter++.ToString()}";
+ private ItemModel GenerateItem() => new ItemModel(_counter ++);
+ }
+
+ ///
+ /// An Item model for the
+ ///
+ public class ItemModel
+ {
+ ///
+ /// Creates a new ItemModel with the given ID
+ ///
+ /// The ID to display
+ public ItemModel(int id)
+ {
+ ID = id;
+ }
+
+ ///
+ /// The ID of this Item
+ ///
+ public int ID { get; }
+
+ public override string ToString()
+ {
+ return $"Item {ID}";
+ }
}
}
diff --git a/src/Android/Avalonia.Android/AndroidInputMethod.cs b/src/Android/Avalonia.Android/AndroidInputMethod.cs
index b6adbde738..8d56086470 100644
--- a/src/Android/Avalonia.Android/AndroidInputMethod.cs
+++ b/src/Android/Avalonia.Android/AndroidInputMethod.cs
@@ -95,6 +95,10 @@ namespace Avalonia.Android
_imm.UpdateSelection(_host, surroundingText.AnchorOffset, surroundingText.CursorOffset, surroundingText.AnchorOffset, surroundingText.CursorOffset);
}
+ else
+ {
+ _imm.HideSoftInputFromWindow(_host.WindowToken, HideSoftInputFlags.ImplicitOnly);
+ }
}
private void SurroundingTextChanged(object sender, EventArgs e)
diff --git a/src/Android/Avalonia.Android/AvaloniaMainActivity.cs b/src/Android/Avalonia.Android/AvaloniaMainActivity.cs
index de8d02f188..b24581fb8b 100644
--- a/src/Android/Avalonia.Android/AvaloniaMainActivity.cs
+++ b/src/Android/Avalonia.Android/AvaloniaMainActivity.cs
@@ -4,9 +4,12 @@ using Android.Content;
using Android.Content.Res;
using Android.OS;
using Android.Runtime;
+using Android.Views;
using AndroidX.AppCompat.App;
using AndroidX.Lifecycle;
+using AndroidRect = Android.Graphics.Rect;
+
namespace Avalonia.Android
{
public abstract class AvaloniaMainActivity : AppCompatActivity, IActivityResultHandler
@@ -15,6 +18,7 @@ namespace Avalonia.Android
public Action ActivityResult { get; set; }
internal AvaloniaView View;
+ private GlobalLayoutListener _listener;
protected override void OnCreate(Bundle savedInstanceState)
{
@@ -32,6 +36,10 @@ namespace Avalonia.Android
base.OnCreate(savedInstanceState);
SetContentView(View);
+
+ _listener = new GlobalLayoutListener(View);
+
+ View.ViewTreeObserver?.AddOnGlobalLayoutListener(_listener);
}
public object Content
@@ -57,6 +65,8 @@ namespace Avalonia.Android
{
View.Content = null;
+ View.ViewTreeObserver?.RemoveOnGlobalLayoutListener(_listener);
+
base.OnDestroy();
}
@@ -66,5 +76,20 @@ namespace Avalonia.Android
ActivityResult?.Invoke(requestCode, resultCode, data);
}
+
+ class GlobalLayoutListener : Java.Lang.Object, ViewTreeObserver.IOnGlobalLayoutListener
+ {
+ private AvaloniaView _view;
+
+ public GlobalLayoutListener(AvaloniaView view)
+ {
+ _view = view;
+ }
+
+ public void OnGlobalLayout()
+ {
+ _view.TopLevelImpl?.Resize(_view.TopLevelImpl.ClientSize);
+ }
+ }
}
}
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
index 5f53eb36c8..3b29dbc726 100644
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
@@ -26,6 +26,7 @@ using Avalonia.Rendering;
using Avalonia.Rendering.Composition;
using Java.Lang;
using Math = System.Math;
+using AndroidRect = Android.Graphics.Rect;
namespace Avalonia.Android.Platform.SkiaPlatform
{
@@ -63,7 +64,21 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public IInputRoot InputRoot { get; private set; }
- public virtual Size ClientSize => Size.ToSize(RenderScaling);
+ public virtual Size ClientSize
+ {
+ get
+ {
+ AndroidRect rect = new AndroidRect();
+ AndroidRect intersection = new AndroidRect();
+
+ _view.GetWindowVisibleDisplayFrame(intersection);
+ _view.GetGlobalVisibleRect(rect);
+
+ intersection.Intersect(rect);
+
+ return new PixelSize(intersection.Right - intersection.Left, intersection.Bottom - intersection.Top).ToSize(RenderScaling);
+ }
+ }
public Size? FrameSize => null;
@@ -149,6 +164,11 @@ namespace Avalonia.Android.Platform.SkiaPlatform
Resized?.Invoke(size, PlatformResizeReason.Unspecified);
}
+ internal void Resize(Size size)
+ {
+ Resized?.Invoke(size, PlatformResizeReason.Layout);
+ }
+
class ViewImpl : InvalidationAwareSurfaceView, ISurfaceHolderCallback, IInitEditorInfo
{
private readonly TopLevelImpl _tl;
diff --git a/src/Avalonia.Base/Animation/Animatable.cs b/src/Avalonia.Base/Animation/Animatable.cs
index b045a32cd1..edaa76233e 100644
--- a/src/Avalonia.Base/Animation/Animatable.cs
+++ b/src/Avalonia.Base/Animation/Animatable.cs
@@ -235,7 +235,7 @@ namespace Avalonia.Animation
private object? GetAnimationBaseValue(AvaloniaProperty property)
{
- var value = this.GetBaseValue(property, BindingPriority.LocalValue);
+ var value = this.GetBaseValue(property);
if (value == AvaloniaProperty.UnsetValue)
{
diff --git a/src/Avalonia.Base/Animation/AnimationInstance`1.cs b/src/Avalonia.Base/Animation/AnimationInstance`1.cs
index 52cd4b324f..0881fde988 100644
--- a/src/Avalonia.Base/Animation/AnimationInstance`1.cs
+++ b/src/Avalonia.Base/Animation/AnimationInstance`1.cs
@@ -229,7 +229,7 @@ namespace Avalonia.Animation
private void UpdateNeutralValue()
{
var property = _animator.Property ?? throw new InvalidOperationException("Animator has no property specified.");
- var baseValue = _targetControl.GetBaseValue(property, BindingPriority.LocalValue);
+ var baseValue = _targetControl.GetBaseValue(property);
_neutralValue = baseValue != AvaloniaProperty.UnsetValue ?
(T)baseValue! : (T)_targetControl.GetValue(property)!;
diff --git a/src/Avalonia.Base/Avalonia.Base.csproj b/src/Avalonia.Base/Avalonia.Base.csproj
index d8fcce803f..21bdb794b3 100644
--- a/src/Avalonia.Base/Avalonia.Base.csproj
+++ b/src/Avalonia.Base/Avalonia.Base.csproj
@@ -28,6 +28,7 @@
+
@@ -39,8 +40,8 @@
+
-
diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs
index 6633eabb5d..68c8f19f19 100644
--- a/src/Avalonia.Base/AvaloniaObject.cs
+++ b/src/Avalonia.Base/AvaloniaObject.cs
@@ -1,11 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Runtime.CompilerServices;
using Avalonia.Data;
using Avalonia.Diagnostics;
using Avalonia.Logging;
using Avalonia.PropertyStore;
-using Avalonia.Reactive;
using Avalonia.Threading;
namespace Avalonia
@@ -18,13 +18,11 @@ namespace Avalonia
///
public class AvaloniaObject : IAvaloniaObject, IAvaloniaObjectDebug, INotifyPropertyChanged
{
+ private readonly ValueStore _values;
private AvaloniaObject? _inheritanceParent;
- private List? _directBindings;
private PropertyChangedEventHandler? _inpcChanged;
private EventHandler? _propertyChanged;
private List? _inheritanceChildren;
- private ValueStore? _values;
- private bool _batchUpdate;
///
/// Initializes a new instance of the class.
@@ -32,6 +30,7 @@ namespace Avalonia
public AvaloniaObject()
{
VerifyAccess();
+ _values = new ValueStore(this);
}
///
@@ -59,7 +58,7 @@ namespace Avalonia
///
/// The inheritance parent.
///
- protected AvaloniaObject? InheritanceParent
+ protected internal AvaloniaObject? InheritanceParent
{
get
{
@@ -72,28 +71,10 @@ namespace Avalonia
if (_inheritanceParent != value)
{
- var oldParent = _inheritanceParent;
- var valuestore = _values;
-
_inheritanceParent?.RemoveInheritanceChild(this);
_inheritanceParent = value;
-
- var properties = AvaloniaPropertyRegistry.Instance.GetRegisteredInherited(GetType());
- var propertiesCount = properties.Count;
-
- for (var i = 0; i < propertiesCount; i++)
- {
- var property = properties[i];
- if (valuestore?.IsSet(property) == true)
- {
- // If local value set there can be no change.
- continue;
- }
-
- property.RouteInheritanceParentChanged(this, oldParent);
- }
-
_inheritanceParent?.AddInheritanceChild(this);
+ _values.SetInheritanceParent(value);
}
}
}
@@ -118,24 +99,15 @@ namespace Avalonia
set { this.Bind(binding.Property!, value); }
}
- private ValueStore Values
- {
- get
- {
- if (_values is null)
- {
- _values = new ValueStore(this);
-
- if (_batchUpdate)
- _values.BeginBatchUpdate();
- }
-
- return _values;
- }
- }
-
+ ///
+ /// Returns a value indicating whether the current thread is the UI thread.
+ ///
+ /// true if the current thread is the UI thread; otherwise false.
public bool CheckAccess() => Dispatcher.UIThread.CheckAccess();
+ ///
+ /// Checks that the current thread is the UI thread and throws if not.
+ ///
public void VerifyAccess() => Dispatcher.UIThread.VerifyAccess();
///
@@ -144,9 +116,9 @@ namespace Avalonia
/// The property.
public void ClearValue(AvaloniaProperty property)
{
- property = property ?? throw new ArgumentNullException(nameof(property));
-
- property.RouteClearValue(this);
+ _ = property ?? throw new ArgumentNullException(nameof(property));
+ VerifyAccess();
+ _values.ClearLocalValue(property);
}
///
@@ -234,9 +206,12 @@ namespace Avalonia
/// The value.
public object? GetValue(AvaloniaProperty property)
{
- property = property ?? throw new ArgumentNullException(nameof(property));
+ _ = property ?? throw new ArgumentNullException(nameof(property));
- return property.RouteGetValue(this);
+ if (property.IsDirect)
+ return property.RouteGetValue(this);
+ else
+ return _values.GetValue(property);
}
///
@@ -247,10 +222,9 @@ namespace Avalonia
/// The value.
public T GetValue(StyledPropertyBase property)
{
- property = property ?? throw new ArgumentNullException(nameof(property));
+ _ = property ?? throw new ArgumentNullException(nameof(property));
VerifyAccess();
-
- return GetValueOrInheritedOrDefault(property);
+ return _values.GetValue(property);
}
///
@@ -269,18 +243,11 @@ namespace Avalonia
}
///
- public Optional GetBaseValue(StyledPropertyBase property, BindingPriority maxPriority)
+ public Optional GetBaseValue(StyledPropertyBase property)
{
- property = property ?? throw new ArgumentNullException(nameof(property));
+ _ = property ?? throw new ArgumentNullException(nameof(property));
VerifyAccess();
-
- if (_values is object &&
- _values.TryGetValue(property, maxPriority, out var value))
- {
- return value;
- }
-
- return default;
+ return _values.GetBaseValue(property);
}
///
@@ -346,26 +313,20 @@ namespace Avalonia
T value,
BindingPriority priority = BindingPriority.LocalValue)
{
- property = property ?? throw new ArgumentNullException(nameof(property));
+ _ = property ?? throw new ArgumentNullException(nameof(property));
VerifyAccess();
+ ValidatePriority(priority);
- LogPropertySet(property, value, priority);
+ LogPropertySet(property, value, BindingPriority.LocalValue);
if (value is UnsetValueType)
{
if (priority == BindingPriority.LocalValue)
- {
- Values.ClearLocalValue(property);
- }
- else
- {
- throw new NotSupportedException(
- "Cannot set property to Unset at non-local value priority.");
- }
+ _values.ClearLocalValue(property);
}
- else if (!(value is DoNothingType))
+ else if (value is not DoNothingType)
{
- return Values.SetValue(property, value, priority);
+ return _values.SetValue(property, value, priority);
}
return null;
@@ -382,6 +343,7 @@ namespace Avalonia
property = property ?? throw new ArgumentNullException(nameof(property));
VerifyAccess();
+ property = AvaloniaPropertyRegistry.Instance.GetRegisteredDirect(this, property);
LogPropertySet(property, value, BindingPriority.LocalValue);
SetDirectValueUnchecked(property, value);
}
@@ -398,12 +360,52 @@ namespace Avalonia
public IDisposable Bind(
AvaloniaProperty property,
IObservable