Browse Source

Merge branch 'TextBoxImprovements' of https://github.com/amwx/Avalonia into TextBoxImprovements

pull/9490/head
amwx 4 years ago
parent
commit
c4fe229f4d
  1. 10
      .gitignore
  2. 0
      .ncrunch/Avalonia.Benchmarks.v3.ncrunchproject
  3. 0
      .ncrunch/Avalonia.Browser.Blazor.v3.ncrunchproject
  4. 0
      .ncrunch/Avalonia.Browser.v3.ncrunchproject
  5. 0
      .ncrunch/Avalonia.Designer.HostApp.v3.ncrunchproject
  6. 5
      .ncrunch/Avalonia.Themes.Fluent.net6.0.v3.ncrunchproject
  7. 5
      .ncrunch/Avalonia.Themes.Fluent.netstandard2.0.v3.ncrunchproject
  8. 5
      .ncrunch/Avalonia.Themes.Simple.net6.0.v3.ncrunchproject
  9. 5
      .ncrunch/Avalonia.Themes.Simple.netstandard2.0.v3.ncrunchproject
  10. 5
      .ncrunch/ControlCatalog.Browser.Blazor.v3.ncrunchproject
  11. 5
      .ncrunch/ControlCatalog.Browser.v3.ncrunchproject
  12. 5
      .ncrunch/MobileSandbox.v3.ncrunchproject
  13. 54
      Avalonia.sln
  14. 2
      native/Avalonia.Native/src/OSX/AvnWindow.mm
  15. 2
      native/Avalonia.Native/src/OSX/WindowBaseImpl.h
  16. 5
      native/Avalonia.Native/src/OSX/WindowBaseImpl.mm
  17. 0
      samples/ControlCatalog.Browser.Blazor/App.razor
  18. 4
      samples/ControlCatalog.Browser.Blazor/App.razor.cs
  19. 6
      samples/ControlCatalog.Browser.Blazor/ControlCatalog.Browser.Blazor.csproj
  20. 2
      samples/ControlCatalog.Browser.Blazor/Pages/Index.razor
  21. 2
      samples/ControlCatalog.Browser.Blazor/Program.cs
  22. 0
      samples/ControlCatalog.Browser.Blazor/Properties/launchSettings.json
  23. 0
      samples/ControlCatalog.Browser.Blazor/Shared/MainLayout.razor
  24. 2
      samples/ControlCatalog.Browser.Blazor/_Imports.razor
  25. 0
      samples/ControlCatalog.Browser.Blazor/wwwroot/css/app.css
  26. 0
      samples/ControlCatalog.Browser.Blazor/wwwroot/favicon.ico
  27. 0
      samples/ControlCatalog.Browser.Blazor/wwwroot/index.html
  28. 6
      samples/ControlCatalog.Browser/ControlCatalog.Browser.csproj
  29. 4
      samples/ControlCatalog.Browser/EmbedSample.Browser.cs
  30. 0
      samples/ControlCatalog.Browser/Logo.svg
  31. 4
      samples/ControlCatalog.Browser/Program.cs
  32. 0
      samples/ControlCatalog.Browser/Roots.xml
  33. 0
      samples/ControlCatalog.Browser/app.css
  34. 0
      samples/ControlCatalog.Browser/embed.js
  35. 0
      samples/ControlCatalog.Browser/favicon.ico
  36. 0
      samples/ControlCatalog.Browser/index.html
  37. 0
      samples/ControlCatalog.Browser/main.js
  38. 0
      samples/ControlCatalog.Browser/runtimeconfig.template.json
  39. 51
      samples/ControlCatalog/Pages/DataGridPage.xaml
  40. 1
      src/Avalonia.Base/Avalonia.Base.csproj
  41. 4
      src/Avalonia.Base/Properties/AssemblyInfo.cs
  42. 3
      src/Avalonia.Base/PropertyStore/ValueStore.cs
  43. 129
      src/Avalonia.Base/StyledElement.cs
  44. 27
      src/Avalonia.Base/Styling/ControlTheme.cs
  45. 10
      src/Avalonia.Base/Styling/IStyle.cs
  46. 5
      src/Avalonia.Base/Styling/IStyleable.cs
  47. 8
      src/Avalonia.Base/Styling/IStyler.cs
  48. 54
      src/Avalonia.Base/Styling/Style.cs
  49. 30
      src/Avalonia.Base/Styling/StyleBase.cs
  50. 58
      src/Avalonia.Base/Styling/StyleCache.cs
  51. 35
      src/Avalonia.Base/Styling/Styler.cs
  52. 47
      src/Avalonia.Base/Styling/Styles.cs
  53. 89
      src/Avalonia.Controls.DataGrid/DataGrid.cs
  54. 39
      src/Avalonia.Controls.DataGrid/DataGridColumn.cs
  55. 15
      src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs
  56. 25
      src/Avalonia.Controls.DataGrid/DataGridRow.cs
  57. 14
      src/Avalonia.Controls.DataGrid/DataGridRowGroupHeader.cs
  58. 72
      src/Avalonia.Controls.DataGrid/DataGridRows.cs
  59. 7
      src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml
  60. 5
      src/Avalonia.Controls.DataGrid/Themes/Simple.xaml
  61. 2
      src/Avalonia.Controls/Application.cs
  62. 3
      src/Avalonia.Controls/TopLevel.cs
  63. 2
      src/Avalonia.Controls/Window.cs
  64. 1
      src/Avalonia.Controls/WindowBase.cs
  65. 16
      src/Avalonia.Native/WindowImplBase.cs
  66. 9
      src/Avalonia.Native/avn.idl
  67. 8
      src/Browser/Avalonia.Browser.Blazor/Avalonia.Browser.Blazor.csproj
  68. 11
      src/Browser/Avalonia.Browser.Blazor/AvaloniaView.cs
  69. 4
      src/Browser/Avalonia.Browser.Blazor/BlazorSingleViewLifetime.cs
  70. 2
      src/Browser/Avalonia.Browser/Avalonia.Browser.csproj
  71. 0
      src/Browser/Avalonia.Browser/Avalonia.Browser.props
  72. 0
      src/Browser/Avalonia.Browser/Avalonia.Browser.targets
  73. 8
      src/Browser/Avalonia.Browser/AvaloniaView.cs
  74. 5
      src/Browser/Avalonia.Browser/BrowserNativeControlHost.cs
  75. 4
      src/Browser/Avalonia.Browser/BrowserRuntimePlatform.cs
  76. 4
      src/Browser/Avalonia.Browser/BrowserSingleViewLifetime.cs
  77. 6
      src/Browser/Avalonia.Browser/BrowserTopLevelImpl.cs
  78. 4
      src/Browser/Avalonia.Browser/ClipboardImpl.cs
  79. 2
      src/Browser/Avalonia.Browser/Cursor.cs
  80. 2
      src/Browser/Avalonia.Browser/Interop/AvaloniaModule.cs
  81. 2
      src/Browser/Avalonia.Browser/Interop/CanvasHelper.cs
  82. 2
      src/Browser/Avalonia.Browser/Interop/DomHelper.cs
  83. 2
      src/Browser/Avalonia.Browser/Interop/InputHelper.cs
  84. 2
      src/Browser/Avalonia.Browser/Interop/NativeControlHostHelper.cs
  85. 2
      src/Browser/Avalonia.Browser/Interop/StorageHelper.cs
  86. 2
      src/Browser/Avalonia.Browser/Interop/StreamHelper.cs
  87. 2
      src/Browser/Avalonia.Browser/JSObjectControlHandle.cs
  88. 2
      src/Browser/Avalonia.Browser/Keycodes.cs
  89. 2
      src/Browser/Avalonia.Browser/ManualTriggerRenderTimer.cs
  90. 2
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpu.cs
  91. 2
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpuRenderSession.cs
  92. 2
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpuRenderTarget.cs
  93. 2
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaRasterSurface.cs
  94. 4
      src/Browser/Avalonia.Browser/Skia/BrowserSkiaSurface.cs
  95. 2
      src/Browser/Avalonia.Browser/Skia/IBrowserSkiaSurface.cs
  96. 5
      src/Browser/Avalonia.Browser/Storage/BlobReadableStream.cs
  97. 5
      src/Browser/Avalonia.Browser/Storage/BrowserStorageProvider.cs
  98. 5
      src/Browser/Avalonia.Browser/Storage/WriteableStream.cs
  99. 2
      src/Browser/Avalonia.Browser/WebEmbeddableControlRoot.cs
  100. 2
      src/Browser/Avalonia.Browser/WinStubs.cs

10
.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

0
.ncrunch/Avalonia.Web.Blazor.v3.ncrunchproject → .ncrunch/Avalonia.Benchmarks.v3.ncrunchproject

0
.ncrunch/Avalonia.Web.v3.ncrunchproject → .ncrunch/Avalonia.Browser.Blazor.v3.ncrunchproject

0
.ncrunch/ControlCatalog.Blazor.Web.v3.ncrunchproject → .ncrunch/Avalonia.Browser.v3.ncrunchproject

0
.ncrunch/ControlCatalog.Web.v3.ncrunchproject → .ncrunch/Avalonia.Designer.HostApp.v3.ncrunchproject

5
.ncrunch/Avalonia.Themes.Fluent.net6.0.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<InstrumentOutputAssembly>False</InstrumentOutputAssembly>
</Settings>
</ProjectConfiguration>

5
.ncrunch/Avalonia.Themes.Fluent.netstandard2.0.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<InstrumentOutputAssembly>False</InstrumentOutputAssembly>
</Settings>
</ProjectConfiguration>

5
.ncrunch/Avalonia.Themes.Simple.net6.0.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<InstrumentOutputAssembly>False</InstrumentOutputAssembly>
</Settings>
</ProjectConfiguration>

5
.ncrunch/Avalonia.Themes.Simple.netstandard2.0.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<InstrumentOutputAssembly>False</InstrumentOutputAssembly>
</Settings>
</ProjectConfiguration>

5
.ncrunch/ControlCatalog.Browser.Blazor.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>

5
.ncrunch/ControlCatalog.Browser.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>

5
.ncrunch/MobileSandbox.v3.ncrunchproject

@ -0,0 +1,5 @@
<ProjectConfiguration>
<Settings>
<IgnoreThisComponentCompletely>True</IgnoreThisComponentCompletely>
</Settings>
</ProjectConfiguration>

54
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}

2
native/Avalonia.Native/src/OSX/AvnWindow.mm

@ -171,9 +171,7 @@
_closed = false;
_isEnabled = true;
[self backingScaleFactor];
[self setOpaque:NO];
[self setBackgroundColor: [NSColor clearColor]];
_isExtended = false;
_isTransitioningToFullScreen = false;

2
native/Avalonia.Native/src/OSX/WindowBaseImpl.h

@ -90,7 +90,7 @@ BEGIN_INTERFACE_MAP()
virtual HRESULT CreateNativeControlHost(IAvnNativeControlHost **retOut) override;
virtual HRESULT SetBlurEnabled(bool enable) override;
virtual HRESULT SetTransparencyMode(AvnWindowTransparencyMode mode) override;
virtual HRESULT BeginDragAndDropOperation(AvnDragDropEffects effects, AvnPoint point,
IAvnClipboard *clipboard, IAvnDndResultCallback *cb,

5
native/Avalonia.Native/src/OSX/WindowBaseImpl.mm

@ -489,10 +489,11 @@ HRESULT WindowBaseImpl::CreateNativeControlHost(IAvnNativeControlHost **retOut)
return S_OK;
}
HRESULT WindowBaseImpl::SetBlurEnabled(bool enable) {
HRESULT WindowBaseImpl::SetTransparencyMode(AvnWindowTransparencyMode mode) {
START_COM_CALL;
[StandardContainer ShowBlur:enable];
[Window setBackgroundColor: (mode != Transparent ? [NSColor windowBackgroundColor] : [NSColor clearColor])];
[StandardContainer ShowBlur: mode == Blur];
return S_OK;
}

0
samples/ControlCatalog.Blazor.Web/App.razor → samples/ControlCatalog.Browser.Blazor/App.razor

4
samples/ControlCatalog.Blazor.Web/App.razor.cs → 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
{

6
samples/ControlCatalog.Blazor.Web/ControlCatalog.Blazor.Web.csproj → samples/ControlCatalog.Browser.Blazor/ControlCatalog.Browser.Blazor.csproj

@ -15,15 +15,15 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj" />
<ProjectReference Include="..\..\src\Web\Avalonia.Web.Blazor\Avalonia.Web.Blazor.csproj" />
<ProjectReference Include="..\..\src\Browser\Avalonia.Browser.Blazor\Avalonia.Browser.Blazor.csproj" />
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" />
</ItemGroup>
<Import Project="..\..\build\ReferenceCoreLibraries.props" />
<Import Project="..\..\build\BuildTargets.targets" />
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.props" />
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.targets" />
<Import Project="..\..\src\Browser\Avalonia.Browser\Avalonia.Browser.props" />
<Import Project="..\..\src\Browser\Avalonia.Browser\Avalonia.Browser.targets" />
</Project>

2
samples/ControlCatalog.Blazor.Web/Pages/Index.razor → samples/ControlCatalog.Browser.Blazor/Pages/Index.razor

@ -1,5 +1,5 @@
@page "/"
@using Avalonia.Web.Blazor
@using Avalonia.Browser.Blazor
<AvaloniaView />

2
samples/ControlCatalog.Blazor.Web/Program.cs → 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
{

0
samples/ControlCatalog.Blazor.Web/Properties/launchSettings.json → samples/ControlCatalog.Browser.Blazor/Properties/launchSettings.json

0
samples/ControlCatalog.Blazor.Web/Shared/MainLayout.razor → samples/ControlCatalog.Browser.Blazor/Shared/MainLayout.razor

2
samples/ControlCatalog.Blazor.Web/_Imports.razor → 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

0
samples/ControlCatalog.Blazor.Web/wwwroot/css/app.css → samples/ControlCatalog.Browser.Blazor/wwwroot/css/app.css

0
samples/ControlCatalog.Blazor.Web/wwwroot/favicon.ico → samples/ControlCatalog.Browser.Blazor/wwwroot/favicon.ico

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

0
samples/ControlCatalog.Blazor.Web/wwwroot/index.html → samples/ControlCatalog.Browser.Blazor/wwwroot/index.html

6
samples/ControlCatalog.Web/ControlCatalog.Web.csproj → samples/ControlCatalog.Browser/ControlCatalog.Browser.csproj

@ -26,7 +26,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\Skia\Avalonia.Skia\Avalonia.Skia.csproj" />
<ProjectReference Include="..\..\src\Web\Avalonia.Web\Avalonia.Web.csproj" />
<ProjectReference Include="..\..\src\Browser\Avalonia.Browser\Avalonia.Browser.csproj" />
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" />
</ItemGroup>
@ -39,6 +39,6 @@
<WasmExtraFilesToDeploy Include="app.css" />
</ItemGroup>
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.props" />
<Import Project="..\..\src\Web\Avalonia.Web\Avalonia.Web.targets" />
<Import Project="..\..\src\Browser\Avalonia.Browser\Avalonia.Browser.props" />
<Import Project="..\..\src\Browser\Avalonia.Browser\Avalonia.Browser.targets" />
</Project>

4
samples/ControlCatalog.Web/EmbedSample.Browser.cs → 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
{

0
samples/ControlCatalog.Web/Logo.svg → samples/ControlCatalog.Browser/Logo.svg

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

4
samples/ControlCatalog.Web/Program.cs → 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")]

0
samples/ControlCatalog.Web/Roots.xml → samples/ControlCatalog.Browser/Roots.xml

0
samples/ControlCatalog.Web/app.css → samples/ControlCatalog.Browser/app.css

0
samples/ControlCatalog.Web/embed.js → samples/ControlCatalog.Browser/embed.js

0
samples/ControlCatalog.Web/favicon.ico → samples/ControlCatalog.Browser/favicon.ico

Before

Width:  |  Height:  |  Size: 172 KiB

After

Width:  |  Height:  |  Size: 172 KiB

0
samples/ControlCatalog.Web/index.html → samples/ControlCatalog.Browser/index.html

0
samples/ControlCatalog.Web/main.js → samples/ControlCatalog.Browser/main.js

0
samples/ControlCatalog.Web/runtimeconfig.template.json → samples/ControlCatalog.Browser/runtimeconfig.template.json

51
samples/ControlCatalog/Pages/DataGridPage.xaml

@ -14,22 +14,6 @@
<Setter Property="Background" Value="{Binding Path=GDP, Mode=OneWay, Converter={StaticResource GDPConverter}}" />
</ControlTheme>
</UserControl.Resources>
<UserControl.Styles>
<Style Selector="DataGridColumnHeader:nth-last-child(1)">
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="DataGridCell:nth-last-child(1)">
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="DataGrid#dataGridGrouping DataGridRow:nth-child(5n+3)">
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="DataGrid#dataGridGrouping DataGridRow:nth-last-child(5n+1)">
<Setter Property="Foreground" Value="Blue" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
</UserControl.Styles>
<Grid RowDefinitions="Auto,Auto,*">
<StackPanel Orientation="Vertical" Spacing="4" Grid.Row="0">
<TextBlock Classes="h2">A control for displaying and interacting with a data source.</TextBlock>
@ -45,8 +29,7 @@
<CheckBox x:Name="ShowGDP" IsChecked="True" Content="Toggle GDP Column Visibility"
DockPanel.Dock="Top"/>
<DataGrid Name="dataGrid1" Margin="12" CanUserResizeColumns="True" CanUserReorderColumns="True" CanUserSortColumns="True" HeadersVisibility="All"
RowBackground="#1000"
AlternatingRowBackground="#1fff">
RowBackground="#1000">
<DataGrid.Columns>
<!-- Using HeaderTemplate -->
<DataGridTextColumn Header="Country" HeaderTemplate="{StaticResource Demo.DataTemplates.CountryHeader}" Binding="{Binding Name}" Width="6*" x:DataType="local:Country" />
@ -59,6 +42,24 @@
IsVisible="{Binding #ShowGDP.IsChecked}"
x:DataType="local:Country" />
</DataGrid.Columns>
<DataGrid.CellTheme>
<ControlTheme TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<ControlTheme.Children>
<Style Selector="^:nth-child(1)">
<Setter Property="FontWeight" Value="Bold" />
</Style>
</ControlTheme.Children>
</ControlTheme>
</DataGrid.CellTheme>
<DataGrid.ColumnHeaderTheme>
<ControlTheme TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
<ControlTheme.Children>
<Style Selector="^:nth-child(1)">
<Setter Property="FontWeight" Value="Bold" />
</Style>
</ControlTheme.Children>
</ControlTheme>
</DataGrid.ColumnHeaderTheme>
</DataGrid>
</DockPanel>
</TabItem>
@ -71,6 +72,20 @@
<DataGridTextColumn DisplayIndex="2" Header="Area" Binding="{Binding Area}" Width="3*" x:DataType="local:Country" />
<DataGridTextColumn Header="GDP" Binding="{Binding GDP}" Width="3*" x:DataType="local:Country" />
</DataGrid.Columns>
<DataGrid.RowTheme>
<ControlTheme TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}">
<ControlTheme.Children>
<Style Selector="^:nth-child(5n+3)">
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style Selector="^:nth-last-child(5n+1)">
<Setter Property="Foreground" Value="Blue" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
</ControlTheme.Children>
</ControlTheme>
</DataGrid.RowTheme>
</DataGrid>
</TabItem>
<TabItem x:Name="EditableTab" Header="Editable">

1
src/Avalonia.Base/Avalonia.Base.csproj

@ -42,7 +42,6 @@
<InternalsVisibleTo Include="Avalonia.UnitTests, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Benchmarks, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Win32, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Web.Blazor, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Dialogs, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Diagnostics, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />

4
src/Avalonia.Base/Properties/AssemblyInfo.cs

@ -29,6 +29,6 @@ using Avalonia.Metadata;
[assembly: InternalsVisibleTo("Avalonia.Skia.RenderTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.Skia.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.Web.Blazor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.Web, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.Browser.Blazor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("Avalonia.Browser, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]

3
src/Avalonia.Base/PropertyStore/ValueStore.cs

@ -610,8 +610,7 @@ namespace Avalonia.PropertyStore
private int InsertFrame(ValueFrame frame)
{
// Uncomment this line when #8549 is fixed.
//Debug.Assert(!_frames.Contains(frame));
Debug.Assert(!_frames.Contains(frame));
var index = BinarySearchFrame(frame.Priority);
_frames.Insert(index, frame);

129
src/Avalonia.Base/StyledElement.cs

@ -344,29 +344,30 @@ namespace Avalonia
/// Applies styling to the control if the control is initialized and styling is not
/// already applied.
/// </summary>
/// <remarks>
/// The styling system will automatically apply styling when required, so it should not
/// usually be necessary to call this method manually.
/// </remarks>
/// <returns>
/// A value indicating whether styling is now applied to the control.
/// </returns>
protected bool ApplyStyling()
public bool ApplyStyling()
{
if (_initCount == 0 && !_styled)
{
var styler = AvaloniaLocator.Current.GetService<IStyler>();
var hasPromotedTheme = _hasPromotedTheme;
if (styler is object)
{
GetValueStore().BeginStyling();
GetValueStore().BeginStyling();
try
{
styler.ApplyStyles(this);
}
finally
{
_styled = true;
GetValueStore().EndStyling();
}
try
{
ApplyControlTheme();
ApplyStyles(this);
}
finally
{
_styled = true;
GetValueStore().EndStyling();
}
if (hasPromotedTheme)
@ -505,31 +506,6 @@ namespace Avalonia
};
}
ControlTheme? IStyleable.GetEffectiveTheme()
{
var theme = Theme;
// Explitly set Theme property takes precedence.
if (theme is not null)
return theme;
// If the Theme property is not set, try to find a ControlTheme resource with our StyleKey.
if (_implicitTheme is null)
{
var key = ((IStyleable)this).StyleKey;
if (this.TryFindResource(key, out var value) && value is ControlTheme t)
_implicitTheme = t;
else
_implicitTheme = s_invalidTheme;
}
if (_implicitTheme != s_invalidTheme)
return _implicitTheme;
return null;
}
void IStyleable.DetachStyles() => DetachStyles();
void IStyleHost.StylesAdded(IReadOnlyList<IStyle> styles)
@ -666,6 +642,31 @@ namespace Avalonia
{
}
internal ControlTheme? GetEffectiveTheme()
{
var theme = Theme;
// Explitly set Theme property takes precedence.
if (theme is not null)
return theme;
// If the Theme property is not set, try to find a ControlTheme resource with our StyleKey.
if (_implicitTheme is null)
{
var key = ((IStyleable)this).StyleKey;
if (this.TryFindResource(key, out var value) && value is ControlTheme t)
_implicitTheme = t;
else
_implicitTheme = s_invalidTheme;
}
if (_implicitTheme != s_invalidTheme)
return _implicitTheme;
return null;
}
private static void DataContextNotifying(IAvaloniaObject o, bool updateStarted)
{
if (o is StyledElement element)
@ -730,6 +731,56 @@ namespace Avalonia
}
}
private void ApplyControlTheme()
{
var theme = GetEffectiveTheme();
if (theme is not null)
ApplyControlTheme(theme);
if (TemplatedParent is StyledElement styleableParent &&
styleableParent.GetEffectiveTheme() is { } parentTheme)
{
ApplyControlTheme(parentTheme);
}
}
private void ApplyControlTheme(ControlTheme theme)
{
if (theme.BasedOn is ControlTheme basedOn)
ApplyControlTheme(basedOn);
theme.TryAttach(this, null);
if (theme.HasChildren)
{
foreach (var child in theme.Children)
ApplyStyle(child, null);
}
}
private void ApplyStyles(IStyleHost host)
{
var parent = host.StylingParent;
if (parent != null)
ApplyStyles(parent);
if (host.IsStylesInitialized)
{
foreach (var style in host.Styles)
ApplyStyle(style, host);
}
}
private void ApplyStyle(IStyle style, IStyleHost? host)
{
if (style is Style s)
s.TryAttach(this, host);
foreach (var child in style.Children)
ApplyStyle(child, host);
}
private void OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
{
if (this.GetLogicalParent() == null && !(this is ILogicalRoot))

27
src/Avalonia.Base/Styling/ControlTheme.cs

@ -29,34 +29,27 @@ namespace Avalonia.Styling
/// </summary>
public ControlTheme? BasedOn { get; set; }
public override SelectorMatchResult TryAttach(IStyleable target, object? host)
public override string ToString() => TargetType?.Name ?? "ControlTheme";
internal override void SetParent(StyleBase? parent)
{
throw new InvalidOperationException("ControlThemes cannot be added as a nested style.");
}
internal override SelectorMatchResult TryAttach(IStyleable target, object? host)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
if (TargetType is null)
throw new InvalidOperationException("ControlTheme has no TargetType.");
var result = BasedOn?.TryAttach(target, host) ?? SelectorMatchResult.NeverThisType;
if (HasSettersOrAnimations && TargetType.IsAssignableFrom(target.StyleKey))
{
Attach(target, null);
result = SelectorMatchResult.AlwaysThisType;
return SelectorMatchResult.AlwaysThisType;
}
var childResult = TryAttachChildren(target, host);
if (childResult > result)
result = childResult;
return result;
}
public override string ToString() => TargetType?.Name ?? "ControlTheme";
internal override void SetParent(StyleBase? parent)
{
throw new InvalidOperationException("ControlThemes cannot be added as a nested style.");
return SelectorMatchResult.NeverThisType;
}
}
}

10
src/Avalonia.Base/Styling/IStyle.cs

@ -14,15 +14,5 @@ namespace Avalonia.Styling
/// Gets a collection of child styles.
/// </summary>
IReadOnlyList<IStyle> Children { get; }
/// <summary>
/// Attaches the style and any child styles to a control if the style's selector matches.
/// </summary>
/// <param name="target">The control to attach to.</param>
/// <param name="host">The element that hosts the style.</param>
/// <returns>
/// A <see cref="SelectorMatchResult"/> describing how the style matches the control.
/// </returns>
SelectorMatchResult TryAttach(IStyleable target, object? host);
}
}

5
src/Avalonia.Base/Styling/IStyleable.cs

@ -25,11 +25,6 @@ namespace Avalonia.Styling
/// </summary>
ITemplatedControl? TemplatedParent { get; }
/// <summary>
/// Gets the effective theme for the control as used by the syling system.
/// </summary>
ControlTheme? GetEffectiveTheme();
void DetachStyles();
}
}

8
src/Avalonia.Base/Styling/IStyler.cs

@ -1,8 +0,0 @@
namespace Avalonia.Styling
{
public interface IStyler
{
void ApplyStyles(IStyleable control);
}
}

54
src/Avalonia.Base/Styling/Style.cs

@ -1,5 +1,4 @@
using System;
using Avalonia.PropertyStore;
namespace Avalonia.Styling
{
@ -35,35 +34,6 @@ namespace Avalonia.Styling
set => _selector = ValidateSelector(value);
}
public override SelectorMatchResult TryAttach(IStyleable target, object? host)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
var result = SelectorMatchResult.NeverThisType;
if (HasSettersOrAnimations)
{
var match = Selector?.Match(target, Parent, true) ??
(target == host ?
SelectorMatch.AlwaysThisInstance :
SelectorMatch.NeverThisInstance);
if (match.IsMatch)
{
Attach(target, match.Activator);
}
result = match.Result;
}
var childResult = TryAttachChildren(target, host);
if (childResult > result)
result = childResult;
return result;
}
/// <summary>
/// Returns a string representation of the style.
/// </summary>
@ -88,6 +58,30 @@ namespace Avalonia.Styling
base.SetParent(parent);
}
internal override SelectorMatchResult TryAttach(IStyleable target, object? host)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
var result = SelectorMatchResult.NeverThisType;
if (HasSettersOrAnimations)
{
var match = Selector?.Match(target, Parent, true) ??
(target == host ?
SelectorMatch.AlwaysThisInstance :
SelectorMatch.NeverThisInstance);
if (match.IsMatch)
{
Attach(target, match.Activator);
}
result = match.Result;
}
return result;
}
private static Selector? ValidateSelector(Selector? selector)
{
if (selector is TemplateSelector)

30
src/Avalonia.Base/Styling/StyleBase.cs

@ -18,7 +18,6 @@ namespace Avalonia.Styling
private IResourceDictionary? _resources;
private List<ISetter>? _setters;
private List<IAnimation>? _animations;
private StyleCache? _childCache;
private StyleInstance? _sharedInstance;
public IList<IStyle> Children => _children ??= new(this);
@ -67,6 +66,7 @@ namespace Avalonia.Styling
bool IResourceNode.HasResources => _resources?.Count > 0;
IReadOnlyList<IStyle> IStyle.Children => (IReadOnlyList<IStyle>?)_children ?? Array.Empty<IStyle>();
internal bool HasChildren => _children?.Count > 0;
internal bool HasSettersOrAnimations => _setters?.Count > 0 || _animations?.Count > 0;
public void Add(ISetter setter) => Setters.Add(setter);
@ -74,14 +74,26 @@ namespace Avalonia.Styling
public event EventHandler? OwnerChanged;
public abstract SelectorMatchResult TryAttach(IStyleable target, object? host);
public bool TryGetResource(object key, out object? result)
{
result = null;
return _resources?.TryGetResource(key, out result) ?? false;
if (_resources is not null && _resources.TryGetResource(key, out result))
return true;
if (_children is not null)
{
for (var i = 0; i < _children.Count; ++i)
{
if (_children[i].TryGetResource(key, out result))
return true;
}
}
result= null;
return false;
}
internal abstract SelectorMatchResult TryAttach(IStyleable target, object? host);
internal ValueFrame Attach(IStyleable target, IStyleActivator? activator)
{
if (target is not AvaloniaObject ao)
@ -124,14 +136,6 @@ namespace Avalonia.Styling
return instance;
}
internal SelectorMatchResult TryAttachChildren(IStyleable target, object? host)
{
if (_children is null || _children.Count == 0)
return SelectorMatchResult.NeverThisType;
_childCache ??= new StyleCache();
return _childCache.TryAttach(_children, target, host);
}
internal virtual void SetParent(StyleBase? parent) => Parent = parent;
void IResourceProvider.AddOwner(IResourceHost owner)

58
src/Avalonia.Base/Styling/StyleCache.cs

@ -1,58 +0,0 @@
using System;
using System.Collections.Generic;
namespace Avalonia.Styling
{
/// <summary>
/// Simple cache for improving performance of applying styles.
/// </summary>
/// <remarks>
/// Maps <see cref="IStyleable.StyleKey"/> to a list of styles that are known be be possible
/// matches.
/// </remarks>
internal class StyleCache : Dictionary<Type, List<IStyle>?>
{
public SelectorMatchResult TryAttach(IList<IStyle> styles, IStyleable target, object? host)
{
if (TryGetValue(target.StyleKey, out var cached))
{
if (cached is object)
{
var result = SelectorMatchResult.NeverThisType;
foreach (var style in cached)
{
var childResult = style.TryAttach(target, host);
if (childResult > result)
result = childResult;
}
return result;
}
else
{
return SelectorMatchResult.NeverThisType;
}
}
else
{
List<IStyle>? matches = null;
foreach (var child in styles)
{
if (child.TryAttach(target, host) != SelectorMatchResult.NeverThisType)
{
matches ??= new List<IStyle>();
matches.Add(child);
}
}
Add(target.StyleKey, matches);
return matches is null ?
SelectorMatchResult.NeverThisType :
SelectorMatchResult.AlwaysThisType;
}
}
}
}

35
src/Avalonia.Base/Styling/Styler.cs

@ -1,35 +0,0 @@
using System;
namespace Avalonia.Styling
{
public class Styler : IStyler
{
public void ApplyStyles(IStyleable target)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
// Apply the control theme.
target.GetEffectiveTheme()?.TryAttach(target, target);
// If the control has a themed templated parent then apply the styles from the
// templated parent theme.
if (target.TemplatedParent is IStyleable styleableParent)
styleableParent.GetEffectiveTheme()?.TryAttach(target, styleableParent);
// Apply styles from the rest of the tree.
if (target is IStyleHost styleHost)
ApplyStyles(target, styleHost);
}
private void ApplyStyles(IStyleable target, IStyleHost host)
{
var parent = host.StylingParent;
if (parent != null)
ApplyStyles(target, parent);
if (host.IsStylesInitialized)
host.Styles.TryAttach(target, host);
}
}
}

47
src/Avalonia.Base/Styling/Styles.cs

@ -5,8 +5,6 @@ using System.Collections.Specialized;
using Avalonia.Collections;
using Avalonia.Controls;
#nullable enable
namespace Avalonia.Styling
{
/// <summary>
@ -20,7 +18,6 @@ namespace Avalonia.Styling
private readonly AvaloniaList<IStyle> _styles = new();
private IResourceHost? _owner;
private IResourceDictionary? _resources;
private StyleCache? _cache;
public Styles()
{
@ -116,12 +113,6 @@ namespace Avalonia.Styling
set => _styles[index] = value;
}
public SelectorMatchResult TryAttach(IStyleable target, object? host)
{
_cache ??= new StyleCache();
return _cache.TryAttach(this, target, host);
}
/// <inheritdoc/>
public bool TryGetResource(object key, out object? value)
{
@ -234,6 +225,22 @@ namespace Avalonia.Styling
}
}
internal SelectorMatchResult TryAttach(IStyleable target, object? host)
{
var result = SelectorMatchResult.NeverThisType;
foreach (var s in this)
{
if (s is not Style style)
continue;
var r = style.TryAttach(target, host);
if (r > result)
result = r;
}
return result;
}
private static IReadOnlyList<T> ToReadOnlyList<T>(ICollection list)
{
if (list is IReadOnlyList<T> readOnlyList)
@ -246,7 +253,7 @@ namespace Avalonia.Styling
return result;
}
private static void InternalAdd(IList items, IResourceHost? owner, ref StyleCache? cache)
private static void InternalAdd(IList items, IResourceHost? owner)
{
if (owner is not null)
{
@ -260,14 +267,9 @@ namespace Avalonia.Styling
(owner as IStyleHost)?.StylesAdded(ToReadOnlyList<IStyle>(items));
}
if (items.Count > 0)
{
cache = null;
}
}
private static void InternalRemove(IList items, IResourceHost? owner, ref StyleCache? cache)
private static void InternalRemove(IList items, IResourceHost? owner)
{
if (owner is not null)
{
@ -281,11 +283,6 @@ namespace Avalonia.Styling
(owner as IStyleHost)?.StylesRemoved(ToReadOnlyList<IStyle>(items));
}
if (items.Count > 0)
{
cache = null;
}
}
private void OnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
@ -300,14 +297,14 @@ namespace Avalonia.Styling
switch (e.Action)
{
case NotifyCollectionChangedAction.Add:
InternalAdd(e.NewItems!, currentOwner, ref _cache);
InternalAdd(e.NewItems!, currentOwner);
break;
case NotifyCollectionChangedAction.Remove:
InternalRemove(e.OldItems!, currentOwner, ref _cache);
InternalRemove(e.OldItems!, currentOwner);
break;
case NotifyCollectionChangedAction.Replace:
InternalRemove(e.OldItems!, currentOwner, ref _cache);
InternalAdd(e.NewItems!, currentOwner, ref _cache);
InternalRemove(e.OldItems!, currentOwner);
InternalAdd(e.NewItems!, currentOwner);
break;
}

89
src/Avalonia.Controls.DataGrid/DataGrid.cs

@ -26,6 +26,7 @@ using Avalonia.Controls.Utils;
using Avalonia.Layout;
using Avalonia.Controls.Metadata;
using Avalonia.Input.GestureRecognizers;
using Avalonia.Styling;
namespace Avalonia.Controls
{
@ -238,29 +239,72 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<DataGrid, DataGridLength>(nameof(ColumnWidth), defaultValue: DataGridLength.Auto);
/// <summary>
/// Gets or sets the standard width or automatic sizing mode of columns in the control.
/// Identifies the <see cref="RowTheme"/> dependency property.
/// </summary>
public DataGridLength ColumnWidth
public static readonly StyledProperty<ControlTheme> RowThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(RowTheme));
/// <summary>
/// Gets or sets the theme applied to all rows.
/// </summary>
public ControlTheme RowTheme
{
get { return GetValue(ColumnWidthProperty); }
set { SetValue(ColumnWidthProperty, value); }
get { return GetValue(RowThemeProperty); }
set { SetValue(RowThemeProperty, value); }
}
public static readonly StyledProperty<IBrush> AlternatingRowBackgroundProperty =
AvaloniaProperty.Register<DataGrid, IBrush>(nameof(AlternatingRowBackground));
/// <summary>
/// Identifies the <see cref="CellTheme"/> dependency property.
/// </summary>
public static readonly StyledProperty<ControlTheme> CellThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(CellTheme));
/// <summary>
/// Gets or sets the <see cref="T:System.Windows.Media.Brush" /> that is used to paint the background of odd-numbered rows.
/// Gets or sets the theme applied to all cells.
/// </summary>
/// <returns>
/// The brush that is used to paint the background of odd-numbered rows. The default is a
/// <see cref="T:System.Windows.Media.SolidColorBrush" /> with a
/// <see cref="P:System.Windows.Media.SolidColorBrush.Color" /> value of white (ARGB value #00FFFFFF).
/// </returns>
public IBrush AlternatingRowBackground
public ControlTheme CellTheme
{
get { return GetValue(CellThemeProperty); }
set { SetValue(CellThemeProperty, value); }
}
/// <summary>
/// Identifies the <see cref="ColumnHeaderTheme"/> dependency property.
/// </summary>
public static readonly StyledProperty<ControlTheme> ColumnHeaderThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(ColumnHeaderTheme));
/// <summary>
/// Gets or sets the theme applied to all column headers.
/// </summary>
public ControlTheme ColumnHeaderTheme
{
get { return GetValue(ColumnHeaderThemeProperty); }
set { SetValue(ColumnHeaderThemeProperty, value); }
}
/// <summary>
/// Identifies the <see cref="RowGroupTheme"/> dependency property.
/// </summary>
public static readonly StyledProperty<ControlTheme> RowGroupThemeProperty =
AvaloniaProperty.Register<DataGrid, ControlTheme>(nameof(RowGroupTheme));
/// <summary>
/// Gets or sets the theme applied to all row groups.
/// </summary>
public ControlTheme RowGroupTheme
{
get { return GetValue(AlternatingRowBackgroundProperty); }
set { SetValue(AlternatingRowBackgroundProperty, value); }
get { return GetValue(RowGroupThemeProperty); }
set { SetValue(RowGroupThemeProperty, value); }
}
/// <summary>
/// Gets or sets the standard width or automatic sizing mode of columns in the control.
/// </summary>
public DataGridLength ColumnWidth
{
get { return GetValue(ColumnWidthProperty); }
set { SetValue(ColumnWidthProperty, value); }
}
public static readonly StyledProperty<int> FrozenColumnCountProperty =
@ -2058,7 +2102,7 @@ namespace Avalonia.Controls
forceHorizontalScroll: true);
}
}
protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
{
base.OnAttachedToVisualTree(e);
@ -2167,7 +2211,7 @@ namespace Avalonia.Controls
return desiredSize;
}
/// <inheritdoc/>
protected override void OnDataContextBeginUpdate()
{
@ -2183,7 +2227,7 @@ namespace Avalonia.Controls
NotifyDataContextPropertyForAllRowCells(GetAllRows(), false);
}
/// <summary>
/// Raises the BeginningEdit event.
/// </summary>
@ -3242,7 +3286,6 @@ namespace Avalonia.Controls
}
}
//TODO Styles
private void AddNewCellPrivate(DataGridRow row, DataGridColumn column)
{
DataGridCell newCell = new DataGridCell();
@ -3255,8 +3298,11 @@ namespace Avalonia.Controls
{
newCell.OwningColumn = column;
newCell.IsVisible = column.IsVisible;
if (row.OwningGrid.CellTheme is {} cellTheme)
{
newCell.SetValue(ThemeProperty, cellTheme, BindingPriority.TemplatedParent);
}
}
//newCell.EnsureStyle(null);
row.Cells.Insert(column.Index, newCell);
}
@ -4537,7 +4583,6 @@ namespace Avalonia.Controls
FlushCurrentCellChanged();
}
//TODO Styles
private void PopulateCellContent(bool isCellEdited,
DataGridColumn dataGridColumn,
DataGridRow dataGridRow,
@ -4575,7 +4620,7 @@ namespace Avalonia.Controls
dataGridCell.Content = element;
}
}
private void PreparingCellForEditPrivate(Control editingElement)

39
src/Avalonia.Controls.DataGrid/DataGridColumn.cs

@ -231,7 +231,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Gets or sets a value that indicates whether the user can change the column display position by
/// Gets or sets a value that indicates whether the user can change the column display position by
/// dragging the column header.
/// </summary>
/// <returns>
@ -260,15 +260,15 @@ namespace Avalonia.Controls
/// </returns>
public bool CanUserResize
{
get
get
{
return
CanUserResizeInternal ??
OwningGrid?.CanUserResizeColumns ??
DataGrid.DATAGRID_defaultCanUserResizeColumns;
}
set
{
set
{
CanUserResizeInternal = value;
OwningGrid?.OnColumnCanUserResizeChanged(this);
}
@ -321,16 +321,16 @@ namespace Avalonia.Controls
/// </returns>
/// <exception cref="T:System.ArgumentOutOfRangeException">
/// When setting this property, the specified value is less than -1 or equal to <see cref="F:System.Int32.MaxValue" />.
///
///
/// -or-
///
///
/// When setting this property on a column in a <see cref="T:Avalonia.Controls.DataGrid" />, the specified value is less than zero or greater than or equal to the number of columns in the <see cref="T:Avalonia.Controls.DataGrid" />.
/// </exception>
/// <exception cref="T:System.InvalidOperationException">
/// When setting this property, the <see cref="T:Avalonia.Controls.DataGrid" /> is already making <see cref="P:Avalonia.Controls.DataGridColumn.DisplayIndex" /> adjustments. For example, this exception is thrown when you attempt to set <see cref="P:Avalonia.Controls.DataGridColumn.DisplayIndex" /> in a <see cref="E:Avalonia.Controls.DataGrid.ColumnDisplayIndexChanged" /> event handler.
///
///
/// -or-
///
///
/// When setting this property, the specified value would result in a frozen column being displayed in the range of unfrozen columns, or an unfrozen column being displayed in the range of frozen columns.
/// </exception>
public int DisplayIndex
@ -401,7 +401,7 @@ namespace Avalonia.Controls
}
}
}
/// <summary>
/// Backing field for CellTheme property.
/// </summary>
@ -412,7 +412,7 @@ namespace Avalonia.Controls
(o, v) => o.CellTheme = v);
/// <summary>
/// Gets or sets the <see cref="DataGridColumnHeader"/> cell theme.
/// Gets or sets the <see cref="DataGridColumnHeader"/> cell theme.
/// </summary>
public ControlTheme CellTheme
{
@ -430,14 +430,14 @@ namespace Avalonia.Controls
(o, v) => o.Header = v);
/// <summary>
/// Gets or sets the <see cref="DataGridColumnHeader"/> content
/// Gets or sets the <see cref="DataGridColumnHeader"/> content
/// </summary>
public object Header
{
get { return _header; }
set { SetAndRaise(HeaderProperty, ref _header, value); }
}
/// <summary>
/// Backing field for Header property
/// </summary>
@ -455,7 +455,7 @@ namespace Avalonia.Controls
get { return _headerTemplate; }
set { SetAndRaise(HeaderTemplateProperty, ref _headerTemplate, value); }
}
public bool IsAutoGenerated
{
get;
@ -750,7 +750,7 @@ namespace Avalonia.Controls
protected abstract IControl GenerateEditingElement(DataGridCell cell, object dataItem, out ICellEditBinding binding);
/// <summary>
/// When overridden in a derived class, gets a read-only element that is bound to the column's
/// When overridden in a derived class, gets a read-only element that is bound to the column's
/// <see cref="P:Avalonia.Controls.DataGridBoundColumn.Binding" /> property value.
/// </summary>
/// <param name="cell">
@ -765,7 +765,7 @@ namespace Avalonia.Controls
protected abstract IControl GenerateElement(DataGridCell cell, object dataItem);
/// <summary>
/// Called by a specific column type when one of its properties changed,
/// Called by a specific column type when one of its properties changed,
/// and its current cells need to be updated.
/// </summary>
/// <param name="propertyName">Indicates which property changed and caused this call</param>
@ -882,9 +882,8 @@ namespace Avalonia.Controls
{
LayoutRoundedWidth = ActualWidth;
}
}
}
//TODO Styles
internal virtual DataGridColumnHeader CreateHeader()
{
var result = new DataGridColumnHeader
@ -893,8 +892,10 @@ namespace Avalonia.Controls
};
result[!ContentControl.ContentProperty] = this[!HeaderProperty];
result[!ContentControl.ContentTemplateProperty] = this[!HeaderTemplateProperty];
//result.EnsureStyle(null);
if (OwningGrid.ColumnHeaderTheme is {} columnTheme)
{
result.SetValue(StyledElement.ThemeProperty, columnTheme, BindingPriority.TemplatedParent);
}
return result;
}

15
src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs

@ -76,7 +76,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.Primitives.DataGridColumnHeader" /> class.
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.Primitives.DataGridColumnHeader" /> class.
/// </summary>
//TODO Implement
public DataGridColumnHeader()
@ -267,7 +267,7 @@ namespace Avalonia.Controls
else
{
newSort = sort;
}
}
// changing direction should not affect sort order, so we replace this column's
// sort description instead of just adding it to the end of the collection
@ -603,7 +603,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Returns true if the mouse is
/// Returns true if the mouse is
/// - to the left of the element, or within the left half of the element
/// and
/// - within the vertical range of the element, or ignoreVertical == true
@ -663,16 +663,19 @@ namespace Avalonia.Controls
IsMouseOver = false;
}
//TODO Styles DragIndicator
private void OnMouseMove_BeginReorder(Point mousePosition)
{
DataGridColumnHeader dragIndicator = new DataGridColumnHeader
var dragIndicator = new DataGridColumnHeader
{
OwningColumn = OwningColumn,
IsEnabled = false,
Content = Content,
ContentTemplate = ContentTemplate
};
if (OwningGrid.ColumnHeaderTheme is {} columnHeaderTheme)
{
dragIndicator.SetValue(ThemeProperty, columnHeaderTheme, BindingPriority.TemplatedParent);
}
dragIndicator.PseudoClasses.Add(":dragIndicator");
@ -720,7 +723,7 @@ namespace Avalonia.Controls
{
return;
}
//handle entry into reorder mode
if (_dragMode == DragMode.MouseDown && _dragColumn == null && _lastMousePositionHeaders != null && (distanceFromRight > DATAGRIDCOLUMNHEADER_resizeRegionWidth && distanceFromLeft > DATAGRIDCOLUMNHEADER_resizeRegionWidth))
{

25
src/Avalonia.Controls.DataGrid/DataGridRow.cs

@ -89,7 +89,7 @@ namespace Avalonia.Controls
o => o.IsValid);
/// <summary>
/// Gets a value that indicates whether the data in a row is valid.
/// Gets a value that indicates whether the data in a row is valid.
/// </summary>
public bool IsValid
{
@ -130,7 +130,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.DataGridRow" /> class.
/// Initializes a new instance of the <see cref="T:Avalonia.Controls.DataGridRow" /> class.
/// </summary>
public DataGridRow()
{
@ -240,7 +240,6 @@ namespace Avalonia.Controls
private set;
}
//TODO Styles
internal DataGridCell FillerCell
{
get
@ -252,7 +251,10 @@ namespace Avalonia.Controls
IsVisible = false,
OwningRow = this
};
//_fillerCell.EnsureStyle(null);
if (OwningGrid.CellTheme is {} cellTheme)
{
_fillerCell.SetValue(ThemeProperty, cellTheme, BindingPriority.TemplatedParent);
}
if (_cellsElement != null)
{
_cellsElement.Children.Add(_fillerCell);
@ -506,7 +508,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Measures the children of a <see cref="T:Avalonia.Controls.DataGridRow" /> to
/// Measures the children of a <see cref="T:Avalonia.Controls.DataGridRow" /> to
/// prepare for arranging them during the <see cref="M:System.Windows.FrameworkElement.ArrangeOverride(System.Windows.Size)" /> pass.
/// </summary>
/// <param name="availableSize">
@ -709,8 +711,6 @@ namespace Avalonia.Controls
}
}
// Set the proper style for the Header by walking up the Style hierarchy
//TODO Styles
internal void EnsureHeaderStyleAndVisibility(Styling.Style previousStyle)
{
if (_headerElement != null && OwningGrid != null)
@ -785,7 +785,7 @@ namespace Avalonia.Controls
OwningGrid?.OnRowDetailsChanged();
}
// Returns the actual template that should be sued for Details: either explicity set on this row
// Returns the actual template that should be sued for Details: either explicity set on this row
// or inherited from the DataGrid
private IDataTemplate ActualDetailsTemplate
{
@ -890,7 +890,7 @@ namespace Avalonia.Controls
//TODO Cleanup
double? _previousDetailsHeight = null;
//TODO Animation
//TODO Animation
private void DetailsContent_HeightChanged(double newValue)
{
if (_previousDetailsHeight.HasValue)
@ -907,7 +907,7 @@ namespace Avalonia.Controls
_detailsElement.ContentHeight = newValue;
// Calling this when details are not visible invalidates during layout when we have no work
// Calling this when details are not visible invalidates during layout when we have no work
// to do. In certain scenarios, this could cause a layout cycle
OnRowDetailsChanged();
}
@ -1060,7 +1060,7 @@ namespace Avalonia.Controls
}
}
}
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs change)
{
@ -1084,7 +1084,4 @@ namespace Avalonia.Controls
}
}
//TODO Styles
}

14
src/Avalonia.Controls.DataGrid/DataGridRowGroupHeader.cs

@ -53,7 +53,7 @@ namespace Avalonia.Controls
AvaloniaProperty.Register<DataGridRowGroupHeader, string>(nameof(PropertyName));
/// <summary>
/// Gets or sets the name of the property that this <see cref="T:Avalonia.Controls.DataGrid" /> row is bound to.
/// Gets or sets the name of the property that this <see cref="T:Avalonia.Controls.DataGrid" /> row is bound to.
/// </summary>
public string PropertyName
{
@ -85,8 +85,8 @@ namespace Avalonia.Controls
}
/// <summary>
/// Gets or sets a value that indicates the amount that the
/// children of the <see cref="T:Avalonia.Controls.RowGroupHeader" /> are indented.
/// Gets or sets a value that indicates the amount that the
/// children of the <see cref="T:Avalonia.Controls.RowGroupHeader" /> are indented.
/// </summary>
public double SublevelIndent
{
@ -327,9 +327,9 @@ namespace Avalonia.Controls
{
double xClip = Math.Round(frozenLeftEdge - childLeftEdge);
var rg = new RectangleGeometry();
rg.Rect =
new Rect(xClip, 0,
Math.Max(0, child.Bounds.Width - xClip),
rg.Rect =
new Rect(xClip, 0,
Math.Max(0, child.Bounds.Width - xClip),
child.Bounds.Height);
child.Clip = rg;
}
@ -348,8 +348,6 @@ namespace Avalonia.Controls
}
}
//TODO Styles
//internal void EnsureHeaderStyleAndVisibility(Style previousStyle)
internal void EnsureHeaderVisibility()
{
if (_headerElement != null && OwningGrid != null)

72
src/Avalonia.Controls.DataGrid/DataGridRows.cs

@ -14,6 +14,9 @@ using System.Collections.Specialized;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using Avalonia.Data;
using Avalonia.Styling;
using JetBrains.Annotations;
namespace Avalonia.Controls
{
@ -117,7 +120,7 @@ namespace Avalonia.Controls
detailsCount += GetDetailsCountInclusive(DisplayData.LastScrollingSlot + 1, SlotCount - 1);
}
//
//
double totalDetailsHeight = detailsCount * RowDetailsHeightEstimate;
return totalRowsHeight + totalDetailsHeight;
@ -163,7 +166,7 @@ namespace Avalonia.Controls
}
/// <summary>
/// Clears the entire selection except the indicated row. Displayed rows are deselected explicitly to
/// Clears the entire selection except the indicated row. Displayed rows are deselected explicitly to
/// visualize potential transition effects. The row indicated is selected if it is not already.
/// </summary>
internal void ClearRowSelection(int slotException, bool setAnchorSlot)
@ -270,10 +273,10 @@ namespace Avalonia.Controls
bool isRow = rowIndex != -1;
if (isCollapsed)
{
InsertElement(slot,
element: null,
InsertElement(slot,
element: null,
updateVerticalScrollBarOnly: true,
isCollapsed: true,
isCollapsed: true,
isRow: isRow);
}
else if (SlotIsDisplayed(slot))
@ -285,18 +288,18 @@ namespace Avalonia.Controls
}
else
{
InsertElement(slot, GenerateRowGroupHeader(slot, groupInfo),
InsertElement(slot, GenerateRowGroupHeader(slot, groupInfo),
updateVerticalScrollBarOnly: false,
isCollapsed: false,
isCollapsed: false,
isRow: isRow);
}
}
else
{
InsertElement(slot,
InsertElement(slot,
element: null,
updateVerticalScrollBarOnly: _vScrollBar == null || _vScrollBar.IsVisible,
isCollapsed: false,
isCollapsed: false,
isRow: isRow);
}
}
@ -417,7 +420,7 @@ namespace Avalonia.Controls
if (scrolledHorizontally && DisplayData.FirstScrollingSlot <= slot && DisplayData.LastScrollingSlot >= slot)
{
// If the slot is displayed and we scrolled horizontally, column virtualization could cause the rows to grow.
// As a result we need to force measure on the rows we're displaying and recalculate our First and Last slots
// As a result we need to force measure on the rows we're displaying and recalculate our First and Last slots
// so they're accurate
foreach (DataGridRow row in DisplayData.GetScrollingRows())
{
@ -455,7 +458,7 @@ namespace Avalonia.Controls
deltaY -= GetSlotElementsHeight(slot, firstFullSlot);
if (DisplayData.FirstScrollingSlot - slot > 1)
{
//
//
ResetDisplayedRows();
}
@ -519,7 +522,7 @@ namespace Avalonia.Controls
_verticalOffset = NegVerticalOffset;
}
//
//
Debug.Assert(MathUtilities.LessThanOrClose(NegVerticalOffset, _verticalOffset));
SetVerticalOffset(_verticalOffset);
@ -1025,6 +1028,10 @@ namespace Avalonia.Controls
dataGridRow.Slot = slot;
dataGridRow.OwningGrid = this;
dataGridRow.DataContext = dataContext;
if (RowTheme is {} rowTheme)
{
dataGridRow.SetValue(ThemeProperty, rowTheme, BindingPriority.TemplatedParent);
}
CompleteCellsCollection(dataGridRow);
OnLoadingRow(new DataGridRowEventArgs(dataGridRow));
@ -1104,7 +1111,7 @@ namespace Avalonia.Controls
/// <summary>
/// Checks if the row for the provided dataContext has been generated and is present
/// in either the loaded rows, pre-fetched rows, or editing row.
/// in either the loaded rows, pre-fetched rows, or editing row.
/// The displayed rows are *not* searched. Returns null if the row does not belong to those 3 categories.
/// </summary>
private DataGridRow GetGeneratedRow(object dataContext)
@ -1152,8 +1159,8 @@ namespace Avalonia.Controls
}
else
{
// If we're grouping, the GroupLevel needs to be fixed later by methods calling this
// which end up inserting rows. We don't do it here because elements could be inserted
// If we're grouping, the GroupLevel needs to be fixed later by methods calling this
// which end up inserting rows. We don't do it here because elements could be inserted
// from top to bottom or bottom to up so it's better to do in one pass
slotElement = GenerateRow(RowIndexFromSlot(slot), slot);
}
@ -1161,7 +1168,6 @@ namespace Avalonia.Controls
return slotElement;
}
//TODO Styles
private void InsertDisplayedElement(int slot, Control element, bool wasNewlyAdded, bool updateSlotInformation)
{
// We can only support creating new rows that are adjacent to the currently visible rows
@ -1479,7 +1485,6 @@ namespace Avalonia.Controls
}
}
//TODO Styles
// Makes sure the row shows the proper visuals for selection, currency, details, etc.
private void LoadRowVisualsForDisplay(DataGridRow row)
{
@ -1694,7 +1699,7 @@ namespace Avalonia.Controls
{
// Figure out what row we've scrolled down to and update the value for NegVerticalOffset
NegVerticalOffset = 0;
//
//
if (height > 2 * CellsHeight &&
(RowDetailsVisibilityMode != DataGridRowDetailsVisibilityMode.VisibleWhenSelected || RowDetailsTemplate == null))
{
@ -1755,7 +1760,7 @@ namespace Avalonia.Controls
// Figure out what row we've scrolled up to and update the value for NegVerticalOffset
deltaY = -NegVerticalOffset;
NegVerticalOffset = 0;
//
//
if (height < -2 * CellsHeight &&
(RowDetailsVisibilityMode != DataGridRowDetailsVisibilityMode.VisibleWhenSelected || RowDetailsTemplate == null))
@ -1813,7 +1818,7 @@ namespace Avalonia.Controls
if (MathUtilities.GreaterThanOrClose(0, newVerticalOffset) && newFirstScrollingSlot != 0)
{
// We've scrolled to the top of the ScrollBar, automatically place the user at the very top
// of the DataGrid. If this produces very odd behavior, evaluate the RowHeight estimate.
// of the DataGrid. If this produces very odd behavior, evaluate the RowHeight estimate.
// strategy. For most data, this should be unnoticeable.
ResetDisplayedRows();
NegVerticalOffset = 0;
@ -1994,7 +1999,6 @@ namespace Avalonia.Controls
VisibleSlotCount = 0;
}
//TODO Styles
private void UnloadRow(DataGridRow dataGridRow)
{
Debug.Assert(dataGridRow != null);
@ -2010,16 +2014,13 @@ namespace Avalonia.Controls
OnUnloadingRow(new DataGridRowEventArgs(dataGridRow));
bool recycleRow = CurrentSlot != dataGridRow.Index;
// Don't recycle if the row has a custom Style set
//recycleRow &= (dataGridRow.Style == null || dataGridRow.Style == RowStyle);
if (recycleRow)
{
DisplayData.AddRecyclableRow(dataGridRow);
}
else
{
//
//
_rowsPresenter.Children.Remove(dataGridRow);
dataGridRow.DetachFromDataGrid(false);
}
@ -2240,10 +2241,10 @@ namespace Avalonia.Controls
group.Items.CollectionChanged += CollectionViewGroup_CollectionChanged;
}
var newGroupInfo = new DataGridRowGroupInfo(group, true, parentGroupInfo.Level + 1, insertSlot, insertSlot);
InsertElementAt(insertSlot,
rowIndex: -1,
item: null,
groupInfo: newGroupInfo,
InsertElementAt(insertSlot,
rowIndex: -1,
item: null,
groupInfo: newGroupInfo,
isCollapsed: isCollapsed);
RowGroupHeadersTable.AddValue(insertSlot, newGroupInfo);
}
@ -2256,9 +2257,9 @@ namespace Avalonia.Controls
{
AutoGenerateColumnsPrivate();
}
InsertElementAt(insertSlot, rowIndex,
InsertElementAt(insertSlot, rowIndex,
item: e.NewItems[0],
groupInfo: null,
groupInfo: null,
isCollapsed: isCollapsed);
}
@ -2448,13 +2449,12 @@ namespace Avalonia.Controls
VisibleSlotCount = SlotCount;
}
//TODO Styles
private void RefreshRowGroupHeaders()
{
if (DataConnection.CollectionView != null
&& DataConnection.CollectionView.CanGroup
&& DataConnection.CollectionView.Groups != null
&& DataConnection.CollectionView.IsGrouping
&& DataConnection.CollectionView.IsGrouping
&& DataConnection.CollectionView.GroupingDepth > 0)
{
// Initialize our array for the height of the RowGroupHeaders by Level.
@ -2476,7 +2476,7 @@ namespace Avalonia.Controls
double indent;
for (int i = 0; i < groupLevelCount; i++)
{
indent = DATAGRID_defaultRowGroupSublevelIndent;
indent = DATAGRID_defaultRowGroupSublevelIndent;
RowGroupSublevelIndents[i] = indent;
if (i > 0)
{
@ -2742,6 +2742,10 @@ namespace Avalonia.Controls
groupHeader.RowGroupInfo = rowGroupInfo;
groupHeader.DataContext = rowGroupInfo.CollectionViewGroup;
groupHeader.Level = rowGroupInfo.Level;
if (RowGroupTheme is {} rowGroupTheme)
{
groupHeader.SetValue(ThemeProperty, rowGroupTheme, BindingPriority.TemplatedParent);
}
// Set the RowGroupHeader's PropertyName. Unfortunately, CollectionViewGroup doesn't have this
// so we have to set it manually

7
src/Avalonia.Controls.DataGrid/Themes/Fluent.xaml

@ -232,7 +232,7 @@
<Setter Property="Data" Value="{StaticResource DataGridSortIconDescendingPath}" />
</Style>
</ControlTheme>
<ControlTheme x:Key="DataGridTopLeftColumnHeader" TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
<Setter Property="Template">
<ControlTemplate>
@ -337,10 +337,6 @@
</ControlTemplate>
</Setter>
<Style Selector="^:nth-child(even)">
<Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
</Style>
<Style Selector="^:invalid">
<Style Selector="^ /template/ Rectangle#InvalidVisualElement">
<Setter Property="Opacity" Value="0.4" />
@ -484,7 +480,6 @@
<ControlTheme x:Key="{x:Type DataGrid}" TargetType="DataGrid">
<Setter Property="RowBackground" Value="Transparent" />
<Setter Property="AlternatingRowBackground" Value="Transparent" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />

5
src/Avalonia.Controls.DataGrid/Themes/Simple.xaml

@ -200,10 +200,6 @@
</ControlTemplate>
</Setter>
<Style Selector="^:nth-child(even)">
<Setter Property="Background" Value="{Binding $parent[DataGrid].AlternatingRowBackground}" />
</Style>
<Style Selector="^ /template/ Rectangle#BackgroundRectangle">
<Setter Property="IsVisible" Value="False" />
<Setter Property="Fill" Value="{DynamicResource HighlightBrush}" />
@ -300,7 +296,6 @@
<ControlTheme x:Key="{x:Type DataGrid}"
TargetType="DataGrid">
<Setter Property="RowBackground" Value="{DynamicResource ThemeAccentBrush4}" />
<Setter Property="AlternatingRowBackground" Value="#00FFFFFF" />
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="HeadersVisibility" Value="Column" />
<Setter Property="HorizontalScrollBarVisibility" Value="Auto" />

2
src/Avalonia.Controls/Application.cs

@ -39,7 +39,6 @@ namespace Avalonia
private readonly Lazy<IClipboard?> _clipboard =
new Lazy<IClipboard?>(() => (IClipboard?)AvaloniaLocator.Current.GetService(typeof(IClipboard)));
private readonly Styler _styler = new Styler();
private Styles? _styles;
private IResourceDictionary? _resources;
private bool _notifyingResourcesChanged;
@ -232,7 +231,6 @@ namespace Avalonia
.Bind<IFocusManager>().ToConstant(FocusManager)
.Bind<IInputManager>().ToConstant(InputManager)
.Bind<IKeyboardNavigationHandler>().ToTransient<KeyboardNavigationHandler>()
.Bind<IStyler>().ToConstant(_styler)
.Bind<IScheduler>().ToConstant(AvaloniaScheduler.Instance)
.Bind<IDragDropDevice>().ToConstant(DragDropDevice.Instance);

3
src/Avalonia.Controls/TopLevel.cs

@ -145,7 +145,6 @@ namespace Avalonia.Controls
_actualTransparencyLevel = PlatformImpl.TransparencyLevel;
dependencyResolver = dependencyResolver ?? AvaloniaLocator.Current;
var styler = TryGetService<IStyler>(dependencyResolver);
_accessKeyHandler = TryGetService<IAccessKeyHandler>(dependencyResolver);
_inputManager = TryGetService<IInputManager>(dependencyResolver);
@ -183,8 +182,6 @@ namespace Avalonia.Controls
_globalStyles.GlobalStylesRemoved += ((IStyleHost)this).StylesRemoved;
}
styler?.ApplyStyles(this);
ClientSize = impl.ClientSize;
FrameSize = impl.FrameSize;

2
src/Avalonia.Controls/Window.cs

@ -647,6 +647,7 @@ namespace Avalonia.Controls
RaiseEvent(new RoutedEventArgs(WindowOpenedEvent));
EnsureInitialized();
ApplyStyling();
IsVisible = true;
var initialSize = new Size(
@ -726,6 +727,7 @@ namespace Avalonia.Controls
RaiseEvent(new RoutedEventArgs(WindowOpenedEvent));
EnsureInitialized();
ApplyStyling();
IsVisible = true;
var initialSize = new Size(

1
src/Avalonia.Controls/WindowBase.cs

@ -149,6 +149,7 @@ namespace Avalonia.Controls
try
{
EnsureInitialized();
ApplyStyling();
IsVisible = true;
if (!_hasExecutedInitialLayoutPass)

16
src/Avalonia.Native/WindowImplBase.cs

@ -501,19 +501,17 @@ namespace Avalonia.Native
{
if (TransparencyLevel != transparencyLevel)
{
if (transparencyLevel >= WindowTransparencyLevel.Blur)
{
if (transparencyLevel > WindowTransparencyLevel.Transparent)
transparencyLevel = WindowTransparencyLevel.AcrylicBlur;
}
if(transparencyLevel == WindowTransparencyLevel.None)
{
transparencyLevel = WindowTransparencyLevel.Transparent;
}
TransparencyLevel = transparencyLevel;
_native?.SetBlurEnabled((TransparencyLevel >= WindowTransparencyLevel.Blur).AsComBool());
_native.SetTransparencyMode(transparencyLevel == WindowTransparencyLevel.None
? AvnWindowTransparencyMode.Opaque
: transparencyLevel == WindowTransparencyLevel.Transparent
? AvnWindowTransparencyMode.Transparent
: AvnWindowTransparencyMode.Blur);
TransparencyLevelChanged?.Invoke(TransparencyLevel);
}
}

9
src/Avalonia.Native/avn.idl

@ -466,6 +466,13 @@ enum AvnAutomationControlType
AutomationSeparator,
}
enum AvnWindowTransparencyMode
{
Opaque,
Transparent,
Blur
}
[uuid(809c652e-7396-11d2-9771-00a0c9b4d50c)]
interface IAvaloniaNativeFactory : IUnknown
{
@ -527,7 +534,7 @@ interface IAvnWindowBase : IUnknown
HRESULT CreateNativeControlHost(IAvnNativeControlHost** retOut);
HRESULT BeginDragAndDropOperation(AvnDragDropEffects effects, AvnPoint point,
IAvnClipboard* clipboard, IAvnDndResultCallback* cb, [intptr]void* sourceHandle);
HRESULT SetBlurEnabled(bool enable);
HRESULT SetTransparencyMode(AvnWindowTransparencyMode mode);
}
[uuid(83e588f3-6981-4e48-9ea0-e1e569f79a91), cpp-virtual-inherits]

8
src/Web/Avalonia.Web.Blazor/Avalonia.Web.Blazor.csproj → src/Browser/Avalonia.Browser.Blazor/Avalonia.Browser.Blazor.csproj

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<PackageId>Avalonia.Web.Blazor</PackageId>
<PackageId>Avalonia.Browser.Blazor</PackageId>
<ResolveStaticWebAssetsInputsDependsOn>_IncludeGeneratedAvaloniaStaticFiles;$(ResolveStaticWebAssetsInputsDependsOn)</ResolveStaticWebAssetsInputsDependsOn>
</PropertyGroup>
@ -17,12 +17,12 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Avalonia.Web\Avalonia.Web.csproj" />
<ProjectReference Include="..\Avalonia.Browser\Avalonia.Browser.csproj" />
</ItemGroup>
<Target Name="_IncludeGeneratedAvaloniaStaticFiles">
<ItemGroup>
<_AvaloniaWebAssets Include="$(MSBuildThisFileDirectory)../Avalonia.Web/wwwroot/**/*.*" />
<_AvaloniaWebAssets Include="$(MSBuildThisFileDirectory)../Avalonia.Browser/wwwroot/**/*.*" />
</ItemGroup>
<DefineStaticWebAssets SourceId="$(PackageId)"
SourceType="Computed"
@ -30,7 +30,7 @@
AssetRole="Primary"
CopyToOutputDirectory="PreserveNewest"
CopyToPublishDirectory="PreserveNewest"
ContentRoot="$(MSBuildThisFileDirectory)../Avalonia.Web/wwwroot/"
ContentRoot="$(MSBuildThisFileDirectory)../Avalonia.Browser/wwwroot/"
BasePath="_content\$(PackageId)"
CandidateAssets="@(_AvaloniaWebAssets)"
RelativePathFilter="**.js">

11
src/Web/Avalonia.Web.Blazor/AvaloniaView.cs → src/Browser/Avalonia.Browser.Blazor/AvaloniaView.cs

@ -2,17 +2,18 @@ using System.Runtime.InteropServices.JavaScript;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using System;
using Avalonia.Browser.Interop;
using Avalonia.Controls.ApplicationLifetimes;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Rendering;
using BrowserView = Avalonia.Web.AvaloniaView;
using BrowserView = Avalonia.Browser.AvaloniaView;
namespace Avalonia.Web.Blazor;
namespace Avalonia.Browser.Blazor;
[SupportedOSPlatform("browser")]
public class AvaloniaView : ComponentBase
{
private BrowserView? _browserView;
private Browser.AvaloniaView? _browserView;
private readonly string _containerId;
public AvaloniaView()
@ -32,9 +33,9 @@ public class AvaloniaView : ComponentBase
{
if (OperatingSystem.IsBrowser())
{
await Avalonia.Web.Interop.AvaloniaModule.ImportMain();
await AvaloniaModule.ImportMain();
_browserView = new BrowserView(_containerId);
_browserView = new Browser.AvaloniaView(_containerId);
if (Application.Current?.ApplicationLifetime is ISingleViewApplicationLifetime lifetime)
{
_browserView.Content = lifetime.MainView;

4
src/Web/Avalonia.Web.Blazor/BlazorSingleViewLifetime.cs → src/Browser/Avalonia.Browser.Blazor/BlazorSingleViewLifetime.cs

@ -3,7 +3,7 @@
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
namespace Avalonia.Web.Blazor;
namespace Avalonia.Browser.Blazor;
[SupportedOSPlatform("browser")]
public static class WebAppBuilder
@ -21,7 +21,7 @@ public static class WebAppBuilder
.UseBrowser()
.With(new BrowserPlatformOptions
{
FrameworkAssetPathResolver = new(filePath => $"/_content/Avalonia.Web.Blazor/{filePath}")
FrameworkAssetPathResolver = new(filePath => $"/_content/Avalonia.Browser.Blazor/{filePath}")
});
}

2
src/Web/Avalonia.Web/Avalonia.Web.csproj → src/Browser/Avalonia.Browser/Avalonia.Browser.csproj

@ -50,7 +50,7 @@
</Target>
<ItemGroup Label="InternalsVisibleTo">
<InternalsVisibleTo Include="Avalonia.Web.Blazor, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Browser.Blazor, PublicKey=$(AvaloniaPublicKey)" />
</ItemGroup>
</Project>

0
src/Web/Avalonia.Web/Avalonia.Web.props → src/Browser/Avalonia.Browser/Avalonia.Browser.props

0
src/Web/Avalonia.Web/Avalonia.Web.targets → src/Browser/Avalonia.Browser/Avalonia.Browser.targets

8
src/Web/Avalonia.Web/AvaloniaView.cs → src/Browser/Avalonia.Browser/AvaloniaView.cs

@ -2,7 +2,8 @@
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices.JavaScript;
using Avalonia.Browser.Interop;
using Avalonia.Browser.Skia;
using Avalonia.Collections.Pooled;
using Avalonia.Controls;
using Avalonia.Controls.Embedding;
@ -12,12 +13,9 @@ using Avalonia.Input.Raw;
using Avalonia.Input.TextInput;
using Avalonia.Rendering.Composition;
using Avalonia.Threading;
using Avalonia.Web.Interop;
using Avalonia.Web.Skia;
using SkiaSharp;
namespace Avalonia.Web
namespace Avalonia.Browser
{
[System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings
public partial class AvaloniaView : ITextInputMethodImpl

5
src/Web/Avalonia.Web/BrowserNativeControlHost.cs → src/Browser/Avalonia.Browser/BrowserNativeControlHost.cs

@ -1,12 +1,11 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices.JavaScript;
using Avalonia.Browser.Interop;
using Avalonia.Controls.Platform;
using Avalonia.Platform;
using Avalonia.Web.Interop;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class BrowserNativeControlHost : INativeControlHostImpl
{

4
src/Web/Avalonia.Web/BrowserRuntimePlatform.cs → src/Browser/Avalonia.Browser/BrowserRuntimePlatform.cs

@ -2,10 +2,10 @@ using System;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.JavaScript;
using System.Text.RegularExpressions;
using Avalonia.Browser.Interop;
using Avalonia.Platform;
using Avalonia.Web.Interop;
namespace Avalonia.Web;
namespace Avalonia.Browser;
internal class BrowserRuntimePlatform : StandardRuntimePlatform
{

4
src/Web/Avalonia.Web/BrowserSingleViewLifetime.cs → src/Browser/Avalonia.Browser/BrowserSingleViewLifetime.cs

@ -1,11 +1,11 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Web.Skia;
using System.Runtime.Versioning;
using Avalonia.Browser.Skia;
using Avalonia.Platform;
namespace Avalonia.Web;
namespace Avalonia.Browser;
[SupportedOSPlatform("browser")]
public class BrowserSingleViewLifetime : ISingleViewApplicationLifetime

6
src/Web/Avalonia.Web/BrowserTopLevelImpl.cs → src/Browser/Avalonia.Browser/BrowserTopLevelImpl.cs

@ -2,6 +2,8 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Avalonia.Browser.Skia;
using Avalonia.Browser.Storage;
using Avalonia.Controls;
using Avalonia.Controls.Platform;
using Avalonia.Input;
@ -11,10 +13,8 @@ using Avalonia.Platform;
using Avalonia.Platform.Storage;
using Avalonia.Rendering;
using Avalonia.Rendering.Composition;
using Avalonia.Web.Skia;
using Avalonia.Web.Storage;
namespace Avalonia.Web
namespace Avalonia.Browser
{
[System.Runtime.Versioning.SupportedOSPlatform("browser")] // gets rid of callsite warnings
internal class BrowserTopLevelImpl : ITopLevelImplWithTextInputMethod, ITopLevelImplWithNativeControlHost, ITopLevelImplWithStorageProvider

4
src/Web/Avalonia.Web/ClipboardImpl.cs → src/Browser/Avalonia.Browser/ClipboardImpl.cs

@ -1,10 +1,10 @@
using System;
using System.Threading.Tasks;
using Avalonia.Browser.Interop;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Web.Interop;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class ClipboardImpl : IClipboard
{

2
src/Web/Avalonia.Web/Cursor.cs → src/Browser/Avalonia.Browser/Cursor.cs

@ -3,7 +3,7 @@ using System.IO;
using Avalonia.Input;
using Avalonia.Platform;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class CssCursor : ICursorImpl
{

2
src/Web/Avalonia.Web/Interop/AvaloniaModule.cs → src/Browser/Avalonia.Browser/Interop/AvaloniaModule.cs

@ -1,7 +1,7 @@
using System.Runtime.InteropServices.JavaScript;
using System.Threading.Tasks;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal static partial class AvaloniaModule
{

2
src/Web/Avalonia.Web/Interop/CanvasHelper.cs → src/Browser/Avalonia.Browser/Interop/CanvasHelper.cs

@ -2,7 +2,7 @@
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.JavaScript;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal record GLInfo(int ContextId, uint FboId, int Stencils, int Samples, int Depth);

2
src/Web/Avalonia.Web/Interop/DomHelper.cs → src/Browser/Avalonia.Browser/Interop/DomHelper.cs

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices.JavaScript;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal static partial class DomHelper
{

2
src/Web/Avalonia.Web/Interop/InputHelper.cs → src/Browser/Avalonia.Browser/Interop/InputHelper.cs

@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
using System.Runtime.InteropServices.JavaScript;
using System.Threading.Tasks;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal static partial class InputHelper
{

2
src/Web/Avalonia.Web/Interop/NativeControlHostHelper.cs → src/Browser/Avalonia.Browser/Interop/NativeControlHostHelper.cs

@ -1,7 +1,7 @@
using System;
using System.Runtime.InteropServices.JavaScript;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal static partial class NativeControlHostHelper
{

2
src/Web/Avalonia.Web/Interop/StorageHelper.cs → src/Browser/Avalonia.Browser/Interop/StorageHelper.cs

@ -1,7 +1,7 @@
using System.Runtime.InteropServices.JavaScript;
using System.Threading.Tasks;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
internal static partial class StorageHelper
{

2
src/Web/Avalonia.Web/Interop/StreamHelper.cs → src/Browser/Avalonia.Browser/Interop/StreamHelper.cs

@ -2,7 +2,7 @@
using System.Runtime.InteropServices.JavaScript;
using System.Threading.Tasks;
namespace Avalonia.Web.Interop;
namespace Avalonia.Browser.Interop;
/// <summary>
/// Set of FileSystemWritableFileStream and Blob methods.

2
src/Web/Avalonia.Web/JSObjectControlHandle.cs → src/Browser/Avalonia.Browser/JSObjectControlHandle.cs

@ -3,7 +3,7 @@ using System.Runtime.InteropServices.JavaScript;
using Avalonia.Controls.Platform;
namespace Avalonia.Web;
namespace Avalonia.Browser;
public class JSObjectControlHandle : INativeControlHostDestroyableControlHandle
{

2
src/Web/Avalonia.Web/Keycodes.cs → src/Browser/Avalonia.Browser/Keycodes.cs

@ -2,7 +2,7 @@ using System.Collections.Generic;
using Avalonia.Input;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal static class Keycodes
{

2
src/Web/Avalonia.Web/ManualTriggerRenderTimer.cs → src/Browser/Avalonia.Browser/ManualTriggerRenderTimer.cs

@ -2,7 +2,7 @@ using System;
using System.Diagnostics;
using Avalonia.Rendering;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class ManualTriggerRenderTimer : IRenderTimer
{

2
src/Web/Avalonia.Web/Skia/BrowserSkiaGpu.cs → src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpu.cs

@ -1,7 +1,7 @@
using System.Collections.Generic;
using Avalonia.Skia;
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
public class BrowserSkiaGpu : ISkiaGpu
{

2
src/Web/Avalonia.Web/Skia/BrowserSkiaGpuRenderSession.cs → src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpuRenderSession.cs

@ -1,7 +1,7 @@
using Avalonia.Skia;
using SkiaSharp;
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
internal class BrowserSkiaGpuRenderSession : ISkiaGpuRenderSession
{

2
src/Web/Avalonia.Web/Skia/BrowserSkiaGpuRenderTarget.cs → src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpuRenderTarget.cs

@ -1,7 +1,7 @@
using Avalonia.Skia;
using SkiaSharp;
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
internal class BrowserSkiaGpuRenderTarget : ISkiaGpuRenderTarget
{

2
src/Web/Avalonia.Web/Skia/BrowserSkiaRasterSurface.cs → src/Browser/Avalonia.Browser/Skia/BrowserSkiaRasterSurface.cs

@ -5,7 +5,7 @@ using Avalonia.Platform;
using Avalonia.Skia;
using SkiaSharp;
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
internal class BrowserSkiaRasterSurface : IBrowserSkiaSurface, IFramebufferPlatformSurface, IDisposable
{

4
src/Web/Avalonia.Web/Skia/BrowserSkiaSurface.cs → src/Browser/Avalonia.Browser/Skia/BrowserSkiaSurface.cs

@ -1,7 +1,7 @@
using Avalonia.Web.Interop;
using Avalonia.Browser.Interop;
using SkiaSharp;
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
internal class BrowserSkiaSurface : IBrowserSkiaSurface
{

2
src/Web/Avalonia.Web/Skia/IBrowserSkiaSurface.cs → src/Browser/Avalonia.Browser/Skia/IBrowserSkiaSurface.cs

@ -1,4 +1,4 @@
namespace Avalonia.Web.Skia
namespace Avalonia.Browser.Skia
{
internal interface IBrowserSkiaSurface
{

5
src/Web/Avalonia.Web/Storage/BlobReadableStream.cs → src/Browser/Avalonia.Browser/Storage/BlobReadableStream.cs

@ -3,10 +3,9 @@ using System.IO;
using System.Runtime.InteropServices.JavaScript;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Browser.Interop;
using Avalonia.Web.Interop;
namespace Avalonia.Web.Storage;
namespace Avalonia.Browser.Storage;
[System.Runtime.Versioning.SupportedOSPlatform("browser")]
internal class BlobReadableStream : Stream

5
src/Web/Avalonia.Web/Storage/BrowserStorageProvider.cs → src/Browser/Avalonia.Browser/Storage/BrowserStorageProvider.cs

@ -6,11 +6,10 @@ using System.Linq;
using System.Runtime.InteropServices.JavaScript;
using System.Runtime.Versioning;
using System.Threading.Tasks;
using Avalonia.Browser.Interop;
using Avalonia.Platform.Storage;
using Avalonia.Web.Interop;
namespace Avalonia.Web.Storage;
namespace Avalonia.Browser.Storage;
internal record FilePickerAcceptType(string Description, IReadOnlyDictionary<string, IReadOnlyList<string>> Accept);

5
src/Web/Avalonia.Web/Storage/WriteableStream.cs → src/Browser/Avalonia.Browser/Storage/WriteableStream.cs

@ -3,10 +3,9 @@ using System.IO;
using System.Runtime.InteropServices.JavaScript;
using System.Threading;
using System.Threading.Tasks;
using Avalonia.Browser.Interop;
using Avalonia.Web.Interop;
namespace Avalonia.Web.Storage;
namespace Avalonia.Browser.Storage;
[System.Runtime.Versioning.SupportedOSPlatform("browser")]
// Loose wrapper implementaion of a stream on top of FileAPI FileSystemWritableFileStream

2
src/Web/Avalonia.Web/WebEmbeddableControlRoot.cs → src/Browser/Avalonia.Browser/WebEmbeddableControlRoot.cs

@ -4,7 +4,7 @@ using Avalonia.Media;
using Avalonia.Platform;
using Avalonia.Rendering.SceneGraph;
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class WebEmbeddableControlRoot : EmbeddableControlRoot
{

2
src/Web/Avalonia.Web/WinStubs.cs → src/Browser/Avalonia.Browser/WinStubs.cs

@ -4,7 +4,7 @@ using Avalonia.Platform;
#nullable enable
namespace Avalonia.Web
namespace Avalonia.Browser
{
internal class IconLoaderStub : IPlatformIconLoader
{

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save