diff --git a/.editorconfig b/.editorconfig
index ff7ac5d69e..3620896f34 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -169,6 +169,8 @@ dotnet_diagnostic.CA1828.severity = warning
dotnet_diagnostic.CA1829.severity = warning
#CA1847: Use string.Contains(char) instead of string.Contains(string) with single characters
dotnet_diagnostic.CA1847.severity = warning
+#CACA2211:Non-constant fields should not be visible
+dotnet_diagnostic.CA2211.severity = error
# Wrapping preferences
csharp_wrap_before_ternary_opsigns = false
diff --git a/azure-pipelines-integrationtests.yml b/azure-pipelines-integrationtests.yml
index 43253ac6be..5735da19ab 100644
--- a/azure-pipelines-integrationtests.yml
+++ b/azure-pipelines-integrationtests.yml
@@ -13,14 +13,14 @@ jobs:
steps:
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 6.0.401'
+ displayName: 'Use .NET Core SDK 6.0.404'
inputs:
- version: 6.0.401
+ version: 6.0.404
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 7.0.100'
+ displayName: 'Use .NET Core SDK 7.0.101'
inputs:
- version: 7.0.100
+ version: 7.0.101
- script: system_profiler SPDisplaysDataType |grep Resolution
@@ -51,14 +51,14 @@ jobs:
steps:
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 6.0.401'
+ displayName: 'Use .NET Core SDK 6.0.404'
inputs:
- version: 6.0.401
+ version: 6.0.404
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 7.0.100'
+ displayName: 'Use .NET Core SDK 7.0.101'
inputs:
- version: 7.0.100
+ version: 7.0.101
- task: Windows Application Driver@0
inputs:
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index a3bbc33418..8bab6e68e2 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -30,14 +30,14 @@ jobs:
vmImage: 'ubuntu-20.04'
steps:
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 6.0.401'
+ displayName: 'Use .NET Core SDK 6.0.404'
inputs:
- version: 6.0.401
+ version: 6.0.404
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 7.0'
+ displayName: 'Use .NET Core SDK 7.0.101'
inputs:
- version: 7.0.100
+ version: 7.0.101
- task: CmdLine@2
displayName: 'Install Workloads'
@@ -67,14 +67,14 @@ jobs:
vmImage: 'macos-12'
steps:
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 6.0.401'
+ displayName: 'Use .NET Core SDK 6.0.404'
inputs:
- version: 6.0.401
+ version: 6.0.404
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 7.0.100'
+ displayName: 'Use .NET Core SDK 7.0.101'
inputs:
- version: 7.0.100
+ version: 7.0.101
- task: CmdLine@2
displayName: 'Install Workloads'
@@ -138,14 +138,14 @@ jobs:
SolutionDir: '$(Build.SourcesDirectory)'
steps:
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 6.0.401'
+ displayName: 'Use .NET Core SDK 6.0.404'
inputs:
- version: 6.0.401
+ version: 6.0.404
- task: UseDotNet@2
- displayName: 'Use .NET Core SDK 7.0.100'
+ displayName: 'Use .NET Core SDK 7.0.101'
inputs:
- version: 7.0.100
+ version: 7.0.101
- task: CmdLine@2
displayName: 'Install Workloads'
diff --git a/global.json b/global.json
index a9318b212f..e4a0cc20c2 100644
--- a/global.json
+++ b/global.json
@@ -1,11 +1,9 @@
{
"sdk": {
- "version": "7.0.100",
+ "version": "7.0.101",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
- "Microsoft.Build.Traversal": "1.0.43",
- "MSBuild.Sdk.Extras": "3.0.22",
- "AggregatePackage.NuGet.Sdk" : "0.1.12"
+ "Microsoft.Build.Traversal": "1.0.43"
}
}
diff --git a/samples/ControlCatalog.Android/MainActivity.cs b/samples/ControlCatalog.Android/MainActivity.cs
index 62c582610c..f6fa07dbde 100644
--- a/samples/ControlCatalog.Android/MainActivity.cs
+++ b/samples/ControlCatalog.Android/MainActivity.cs
@@ -5,7 +5,7 @@ using Avalonia.Android;
namespace ControlCatalog.Android
{
- [Activity(Label = "ControlCatalog.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
+ [Activity(Label = "ControlCatalog.Android", Theme = "@style/MyTheme.Main", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)]
public class MainActivity : AvaloniaMainActivity
{
}
diff --git a/samples/ControlCatalog.Android/Resources/values/styles.xml b/samples/ControlCatalog.Android/Resources/values/styles.xml
index 2759d2904a..49e079a719 100644
--- a/samples/ControlCatalog.Android/Resources/values/styles.xml
+++ b/samples/ControlCatalog.Android/Resources/values/styles.xml
@@ -14,4 +14,8 @@
- @null
+
+
diff --git a/samples/ControlCatalog.Android/SplashActivity.cs b/samples/ControlCatalog.Android/SplashActivity.cs
index 908b5f082a..a0b68b129b 100644
--- a/samples/ControlCatalog.Android/SplashActivity.cs
+++ b/samples/ControlCatalog.Android/SplashActivity.cs
@@ -28,6 +28,8 @@ namespace ControlCatalog.Android
base.OnResume();
StartActivity(new Intent(Application.Context, typeof(MainActivity)));
+
+ Finish();
}
}
}
diff --git a/samples/ControlCatalog.Browser/Properties/launchSettings.json b/samples/ControlCatalog.Browser/Properties/launchSettings.json
new file mode 100644
index 0000000000..76c1834e3c
--- /dev/null
+++ b/samples/ControlCatalog.Browser/Properties/launchSettings.json
@@ -0,0 +1,13 @@
+{
+ "profiles": {
+ "ControlCatalog.Browser": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "https://localhost:5001;http://localhost:5000",
+ "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}"
+ }
+ }
+}
diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml
index 9e0fb3f852..166b98436e 100644
--- a/samples/ControlCatalog/MainView.xaml
+++ b/samples/ControlCatalog/MainView.xaml
@@ -209,8 +209,7 @@
+ HorizontalAlignment="Stretch">
None
Transparent
diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs
index 15e666ae7b..f3c1a68e72 100644
--- a/samples/ControlCatalog/MainView.xaml.cs
+++ b/samples/ControlCatalog/MainView.xaml.cs
@@ -6,6 +6,7 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml;
using Avalonia.Media;
using Avalonia.Media.Immutable;
+using Avalonia.VisualTree;
using ControlCatalog.Models;
using ControlCatalog.Pages;
@@ -59,17 +60,25 @@ namespace ControlCatalog
};
var transparencyLevels = this.Get("TransparencyLevels");
- IDisposable? backgroundSetter = null, paneBackgroundSetter = null;
+ IDisposable? topLevelBackgroundSideSetter = null, sideBarBackgroundSetter = null, paneBackgroundSetter = null;
transparencyLevels.SelectionChanged += (sender, e) =>
{
- backgroundSetter?.Dispose();
+ topLevelBackgroundSideSetter?.Dispose();
+ sideBarBackgroundSetter?.Dispose();
paneBackgroundSetter?.Dispose();
- if (transparencyLevels.SelectedItem is WindowTransparencyLevel selected
- && selected != WindowTransparencyLevel.None)
+ if (transparencyLevels.SelectedItem is WindowTransparencyLevel selected)
{
- var semiTransparentBrush = new ImmutableSolidColorBrush(Colors.Gray, 0.5);
- backgroundSetter = sideBar.SetValue(BackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
- paneBackgroundSetter = sideBar.SetValue(SplitView.PaneBackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
+ var topLevel = (TopLevel)this.GetVisualRoot()!;
+ topLevel.TransparencyLevelHint = selected;
+
+ if (selected != WindowTransparencyLevel.None)
+ {
+ var transparentBrush = new ImmutableSolidColorBrush(Colors.White, 0);
+ var semiTransparentBrush = new ImmutableSolidColorBrush(Colors.Gray, 0.2);
+ topLevelBackgroundSideSetter = topLevel.SetValue(BackgroundProperty, transparentBrush, Avalonia.Data.BindingPriority.Style);
+ sideBarBackgroundSetter = sideBar.SetValue(BackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
+ paneBackgroundSetter = sideBar.SetValue(SplitView.PaneBackgroundProperty, semiTransparentBrush, Avalonia.Data.BindingPriority.Style);
+ }
}
};
}
diff --git a/samples/ControlCatalog/MainWindow.xaml b/samples/ControlCatalog/MainWindow.xaml
index cebb3e0916..442c1d37b0 100644
--- a/samples/ControlCatalog/MainWindow.xaml
+++ b/samples/ControlCatalog/MainWindow.xaml
@@ -10,7 +10,6 @@
ExtendClientAreaToDecorationsHint="{Binding ExtendClientAreaEnabled}"
ExtendClientAreaChromeHints="{Binding ChromeHints}"
ExtendClientAreaTitleBarHeightHint="{Binding TitleBarHeight}"
- TransparencyLevelHint="{Binding TransparencyLevel}"
x:Name="MainWindow"
Background="Transparent"
x:Class="ControlCatalog.MainWindow" WindowState="{Binding WindowState, Mode=TwoWay}"
diff --git a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs
index 11f504f4db..7520dabf37 100644
--- a/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/DateTimePickerPage.xaml.cs
@@ -17,7 +17,7 @@ namespace ControlCatalog.Pages
this.Get("TimePickerDesc").Text = "Use a TimePicker to let users set a time in your app, for example " +
"to set a reminder. The TimePicker displays three controls for hour, minute, and AM / PM(if necessary).These controls " +
"are easy to use with touch or mouse, and they can be styled and configured in several different ways. " +
- "12 - hour or 24 - hour clock and visiblility of AM / PM is dynamically set based on user time settings, or can be overridden.";
+ "12 - hour or 24 - hour clock and visibility of AM / PM is dynamically set based on user time settings, or can be overridden.";
}
diff --git a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml
index f1403905c4..d690058b27 100644
--- a/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml
+++ b/samples/ControlCatalog/Pages/WindowCustomizationsPage.xaml
@@ -11,12 +11,5 @@
-
- None
- Transparent
- Blur
- AcrylicBlur
- Mica
-
diff --git a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
index b79eff780c..47c6f70714 100644
--- a/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
+++ b/samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
@@ -12,12 +12,9 @@ namespace ControlCatalog.ViewModels
{
class MainWindowViewModel : ViewModelBase
{
- private IManagedNotificationManager _notificationManager;
-
private bool _isMenuItemChecked = true;
private WindowState _windowState;
private WindowState[] _windowStates = Array.Empty();
- private int _transparencyLevel;
private ExtendClientAreaChromeHints _chromeHints = ExtendClientAreaChromeHints.PreferSystemChrome;
private bool _extendClientAreaEnabled;
private bool _systemTitleBarEnabled;
@@ -77,12 +74,6 @@ namespace ControlCatalog.ViewModels
TitleBarHeight = -1;
}
- public int TransparencyLevel
- {
- get { return _transparencyLevel; }
- set { this.RaiseAndSetIfChanged(ref _transparencyLevel, value); }
- }
-
public ExtendClientAreaChromeHints ChromeHints
{
get { return _chromeHints; }
diff --git a/src/Android/Avalonia.Android/AvaloniaView.cs b/src/Android/Avalonia.Android/AvaloniaView.cs
index 5267843bfc..f7e32f99db 100644
--- a/src/Android/Avalonia.Android/AvaloniaView.cs
+++ b/src/Android/Avalonia.Android/AvaloniaView.cs
@@ -24,6 +24,8 @@ namespace Avalonia.Android
_root = new EmbeddableControlRoot(_view);
_root.Prepare();
+
+ this.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
}
internal TopLevelImpl TopLevelImpl => _view;
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
index 33501ece06..f205458f0e 100644
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
@@ -22,6 +22,7 @@ namespace Avalonia.Android
public InvalidationAwareSurfaceView(Context context) : base(context)
{
Holder.AddCallback(this);
+ Holder.SetFormat(global::Android.Graphics.Format.Transparent);
_handler = new Handler(context.MainLooper);
}
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
index 56dbadca03..1aac567dda 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.Composition;
using Java.Lang;
using Math = System.Math;
using AndroidRect = Android.Graphics.Rect;
+using Android.Graphics.Drawables;
namespace Avalonia.Android.Platform.SkiaPlatform
{
@@ -283,7 +284,7 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public Action LostFocus { get; set; }
public Action TransparencyLevelChanged { get; set; }
- public WindowTransparencyLevel TransparencyLevel => WindowTransparencyLevel.None;
+ public WindowTransparencyLevel TransparencyLevel { get; private set; }
public AcrylicPlatformCompensationLevels AcrylicCompensationLevels => new AcrylicPlatformCompensationLevels(1, 1, 1);
@@ -301,7 +302,87 @@ namespace Avalonia.Android.Platform.SkiaPlatform
public void SetTransparencyLevelHint(WindowTransparencyLevel transparencyLevel)
{
- throw new NotImplementedException();
+ if (TransparencyLevel != transparencyLevel)
+ {
+ bool isBelowR = Build.VERSION.SdkInt < BuildVersionCodes.R;
+ bool isAboveR = Build.VERSION.SdkInt > BuildVersionCodes.R;
+ if (_view.Context is AvaloniaMainActivity activity)
+ {
+ switch (transparencyLevel)
+ {
+ case WindowTransparencyLevel.AcrylicBlur:
+ case WindowTransparencyLevel.ForceAcrylicBlur:
+ case WindowTransparencyLevel.Mica:
+ case WindowTransparencyLevel.None:
+ if (!isBelowR)
+ {
+ activity.SetTranslucent(false);
+ }
+ if (isAboveR)
+ {
+ activity.Window?.ClearFlags(WindowManagerFlags.BlurBehind);
+
+ var attr = activity.Window?.Attributes;
+ if (attr != null)
+ {
+ attr.BlurBehindRadius = 0;
+
+ activity.Window.Attributes = attr;
+ }
+ }
+ activity.Window.SetBackgroundDrawable(new ColorDrawable(Color.White));
+
+ if(transparencyLevel != WindowTransparencyLevel.None)
+ {
+ return;
+ }
+ break;
+ case WindowTransparencyLevel.Transparent:
+ if (!isBelowR)
+ {
+ activity.SetTranslucent(true);
+ }
+ if (isAboveR)
+ {
+ activity.Window?.ClearFlags(WindowManagerFlags.BlurBehind);
+
+ var attr = activity.Window?.Attributes;
+ if (attr != null)
+ {
+ attr.BlurBehindRadius = 0;
+
+ activity.Window.Attributes = attr;
+ }
+ }
+ activity.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
+ break;
+ case WindowTransparencyLevel.Blur:
+ if (isAboveR)
+ {
+ activity.SetTranslucent(true);
+ activity.Window?.AddFlags(WindowManagerFlags.BlurBehind);
+
+ var attr = activity.Window?.Attributes;
+ if (attr != null)
+ {
+ attr.BlurBehindRadius = 120;
+
+ activity.Window.Attributes = attr;
+ }
+ activity.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));
+ }
+ else
+ {
+ activity.Window?.ClearFlags(WindowManagerFlags.BlurBehind);
+ activity.Window.SetBackgroundDrawable(new ColorDrawable(Color.White));
+
+ return;
+ }
+ break;
+ }
+ TransparencyLevel = transparencyLevel;
+ }
+ }
}
}
diff --git a/src/Avalonia.Base/Controls/NameScopeExtensions.cs b/src/Avalonia.Base/Controls/NameScopeExtensions.cs
index 3895b6ceb9..0abd5e56f7 100644
--- a/src/Avalonia.Base/Controls/NameScopeExtensions.cs
+++ b/src/Avalonia.Base/Controls/NameScopeExtensions.cs
@@ -25,13 +25,18 @@ namespace Avalonia.Controls
var result = nameScope.Find(name);
- if (result != null && !(result is T))
+ if (result == null)
{
- throw new InvalidOperationException(
- $"Expected control '{name}' to be '{typeof(T)} but it was '{result.GetType()}'.");
+ return null;
}
- return (T?)result;
+ if (result is T typed)
+ {
+ return typed;
+ }
+
+ throw new InvalidOperationException(
+ $"Expected control '{name}' to be '{typeof(T)} but it was '{result.GetType()}'.");
}
///
@@ -74,13 +79,13 @@ namespace Avalonia.Controls
throw new KeyNotFoundException($"Could not find control '{name}'.");
}
- if (!(result is T))
+ if (result is T typed)
{
- throw new InvalidOperationException(
- $"Expected control '{name}' to be '{typeof(T)} but it was '{result.GetType()}'.");
+ return typed;
}
- return (T)result;
+ throw new InvalidOperationException(
+ $"Expected control '{name}' to be '{typeof(T)} but it was '{result.GetType()}'.");
}
///
diff --git a/src/Avalonia.Base/Media/TextFormatting/InterWordJustification.cs b/src/Avalonia.Base/Media/TextFormatting/InterWordJustification.cs
index 3c3a46c209..21e8ce089a 100644
--- a/src/Avalonia.Base/Media/TextFormatting/InterWordJustification.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/InterWordJustification.cs
@@ -91,7 +91,7 @@ namespace Avalonia.Media.TextFormatting
continue;
}
- if (textRun is ShapedTextCharacters shapedText)
+ if (textRun is ShapedTextRun shapedText)
{
var glyphRun = shapedText.GlyphRun;
var shapedBuffer = shapedText.ShapedBuffer;
diff --git a/src/Avalonia.Base/Media/TextFormatting/ShapedTextCharacters.cs b/src/Avalonia.Base/Media/TextFormatting/ShapedTextRun.cs
similarity index 92%
rename from src/Avalonia.Base/Media/TextFormatting/ShapedTextCharacters.cs
rename to src/Avalonia.Base/Media/TextFormatting/ShapedTextRun.cs
index 3035eb7b18..3149bc2cda 100644
--- a/src/Avalonia.Base/Media/TextFormatting/ShapedTextCharacters.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/ShapedTextRun.cs
@@ -6,11 +6,11 @@ namespace Avalonia.Media.TextFormatting
///
/// A text run that holds shaped characters.
///
- public sealed class ShapedTextCharacters : DrawableTextRun
+ public sealed class ShapedTextRun : DrawableTextRun
{
private GlyphRun? _glyphRun;
- public ShapedTextCharacters(ShapedBuffer shapedBuffer, TextRunProperties properties)
+ public ShapedTextRun(ShapedBuffer shapedBuffer, TextRunProperties properties)
{
ShapedBuffer = shapedBuffer;
CharacterBufferReference = shapedBuffer.CharacterBufferRange.CharacterBufferReference;
@@ -155,7 +155,7 @@ namespace Avalonia.Media.TextFormatting
return length > 0;
}
- internal SplitResult Split(int length)
+ internal SplitResult Split(int length)
{
if (IsReversed)
{
@@ -171,7 +171,7 @@ namespace Avalonia.Media.TextFormatting
var splitBuffer = ShapedBuffer.Split(length);
- var first = new ShapedTextCharacters(splitBuffer.First, Properties);
+ var first = new ShapedTextRun(splitBuffer.First, Properties);
#if DEBUG
@@ -182,9 +182,9 @@ namespace Avalonia.Media.TextFormatting
#endif
- var second = new ShapedTextCharacters(splitBuffer.Second!, Properties);
+ var second = new ShapedTextRun(splitBuffer.Second!, Properties);
- return new SplitResult(first, second);
+ return new SplitResult(first, second);
}
internal GlyphRun CreateGlyphRun()
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextCharacters.cs b/src/Avalonia.Base/Media/TextFormatting/TextCharacters.cs
index 0be753bd04..db035b8750 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextCharacters.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextCharacters.cs
@@ -91,12 +91,12 @@ namespace Avalonia.Media.TextFormatting
public override TextRunProperties Properties { get; }
///
- /// Gets a list of .
+ /// Gets a list of .
///
/// The shapeable text characters.
- internal IReadOnlyList GetShapeableCharacters(CharacterBufferRange characterBufferRange, sbyte biDiLevel, ref TextRunProperties? previousProperties)
+ internal IReadOnlyList GetShapeableCharacters(CharacterBufferRange characterBufferRange, sbyte biDiLevel, ref TextRunProperties? previousProperties)
{
- var shapeableCharacters = new List(2);
+ var shapeableCharacters = new List(2);
while (characterBufferRange.Length > 0)
{
@@ -120,7 +120,7 @@ namespace Avalonia.Media.TextFormatting
/// The bidi level of the run.
///
/// A list of shapeable text runs.
- private static ShapeableTextCharacters CreateShapeableRun(CharacterBufferRange characterBufferRange,
+ private static UnshapedTextRun CreateShapeableRun(CharacterBufferRange characterBufferRange,
TextRunProperties defaultProperties, sbyte biDiLevel, ref TextRunProperties? previousProperties)
{
var defaultTypeface = defaultProperties.Typeface;
@@ -133,12 +133,12 @@ namespace Avalonia.Media.TextFormatting
{
if (TryGetShapeableLength(characterBufferRange, previousTypeface.Value, null, out var fallbackCount, out _))
{
- return new ShapeableTextCharacters(characterBufferRange.CharacterBufferReference, fallbackCount,
+ return new UnshapedTextRun(characterBufferRange.CharacterBufferReference, fallbackCount,
defaultProperties.WithTypeface(previousTypeface.Value), biDiLevel);
}
}
- return new ShapeableTextCharacters(characterBufferRange.CharacterBufferReference, count, defaultProperties.WithTypeface(currentTypeface),
+ return new UnshapedTextRun(characterBufferRange.CharacterBufferReference, count, defaultProperties.WithTypeface(currentTypeface),
biDiLevel);
}
@@ -146,7 +146,7 @@ namespace Avalonia.Media.TextFormatting
{
if (TryGetShapeableLength(characterBufferRange, previousTypeface.Value, defaultTypeface, out count, out _))
{
- return new ShapeableTextCharacters(characterBufferRange.CharacterBufferReference, count,
+ return new UnshapedTextRun(characterBufferRange.CharacterBufferReference, count,
defaultProperties.WithTypeface(previousTypeface.Value), biDiLevel);
}
}
@@ -176,7 +176,7 @@ namespace Avalonia.Media.TextFormatting
if (matchFound && TryGetShapeableLength(characterBufferRange, currentTypeface, defaultTypeface, out count, out _))
{
//Fallback found
- return new ShapeableTextCharacters(characterBufferRange.CharacterBufferReference, count, defaultProperties.WithTypeface(currentTypeface),
+ return new UnshapedTextRun(characterBufferRange.CharacterBufferReference, count, defaultProperties.WithTypeface(currentTypeface),
biDiLevel);
}
@@ -199,7 +199,7 @@ namespace Avalonia.Media.TextFormatting
count += grapheme.Text.Length;
}
- return new ShapeableTextCharacters(characterBufferRange.CharacterBufferReference, count, defaultProperties, biDiLevel);
+ return new UnshapedTextRun(characterBufferRange.CharacterBufferReference, count, defaultProperties, biDiLevel);
}
///
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextEllipsisHelper.cs b/src/Avalonia.Base/Media/TextFormatting/TextEllipsisHelper.cs
index a1b8985b43..086ea85d97 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextEllipsisHelper.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextEllipsisHelper.cs
@@ -31,7 +31,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
currentWidth += shapedRun.Size.Width;
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
index 93eb4811b9..ef2abdfea0 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextFormatterImpl.cs
@@ -124,7 +124,7 @@ namespace Avalonia.Media.TextFormatting
var second = new List(secondCount);
- if (currentRun is ShapedTextCharacters shapedTextCharacters)
+ if (currentRun is ShapedTextRun shapedTextCharacters)
{
var split = shapedTextCharacters.Split(length - currentLength);
@@ -206,16 +206,16 @@ namespace Avalonia.Media.TextFormatting
break;
}
- case ShapeableTextCharacters shapeableRun:
+ case UnshapedTextRun shapeableRun:
{
- var groupedRuns = new List(2) { shapeableRun };
+ var groupedRuns = new List(2) { shapeableRun };
var characterBufferReference = currentRun.CharacterBufferReference;
var length = currentRun.Length;
var offsetToFirstCharacter = characterBufferReference.OffsetToFirstChar;
while (index + 1 < processedRuns.Count)
{
- if (processedRuns[index + 1] is not ShapeableTextCharacters nextRun)
+ if (processedRuns[index + 1] is not UnshapedTextRun nextRun)
{
break;
}
@@ -258,10 +258,10 @@ namespace Avalonia.Media.TextFormatting
return drawableTextRuns;
}
- private static IReadOnlyList ShapeTogether(
- IReadOnlyList textRuns, CharacterBufferReference text, int length, TextShaperOptions options)
+ private static IReadOnlyList ShapeTogether(
+ IReadOnlyList textRuns, CharacterBufferReference text, int length, TextShaperOptions options)
{
- var shapedRuns = new List(textRuns.Count);
+ var shapedRuns = new List(textRuns.Count);
var shapedBuffer = TextShaper.Current.ShapeText(text, length, options);
@@ -271,7 +271,7 @@ namespace Avalonia.Media.TextFormatting
var splitResult = shapedBuffer.Split(currentRun.Length);
- shapedRuns.Add(new ShapedTextCharacters(splitResult.First, currentRun.Properties));
+ shapedRuns.Add(new ShapedTextRun(splitResult.First, currentRun.Properties));
shapedBuffer = splitResult.Second!;
}
@@ -280,9 +280,9 @@ namespace Avalonia.Media.TextFormatting
}
///
- /// Coalesces ranges of the same bidi level to form
+ /// Coalesces ranges of the same bidi level to form
///
- /// The text characters to form from.
+ /// The text characters to form from.
/// The bidi levels.
///
private static IEnumerable> CoalesceLevels(IReadOnlyList textCharacters, ArraySlice levels)
@@ -474,7 +474,7 @@ namespace Avalonia.Media.TextFormatting
{
switch (currentRun)
{
- case ShapedTextCharacters shapedTextCharacters:
+ case ShapedTextRun shapedTextCharacters:
{
if(shapedTextCharacters.ShapedBuffer.Length > 0)
{
@@ -538,7 +538,7 @@ namespace Avalonia.Media.TextFormatting
var shapedBuffer = new ShapedBuffer(characterBufferRange, glyphInfos, glyphTypeface, properties.FontRenderingEmSize,
(sbyte)flowDirection);
- var textRuns = new List { new ShapedTextCharacters(shapedBuffer, properties) };
+ var textRuns = new List { new ShapedTextRun(shapedBuffer, properties) };
return new TextLineImpl(textRuns, firstTextSourceIndex, 0, paragraphWidth, paragraphProperties, flowDirection).FinalizeLine();
}
@@ -744,7 +744,7 @@ namespace Avalonia.Media.TextFormatting
///
/// The shaped symbol.
///
- internal static ShapedTextCharacters CreateSymbol(TextRun textRun, FlowDirection flowDirection)
+ internal static ShapedTextRun CreateSymbol(TextRun textRun, FlowDirection flowDirection)
{
var textShaper = TextShaper.Current;
@@ -760,7 +760,7 @@ namespace Avalonia.Media.TextFormatting
var shapedBuffer = textShaper.ShapeText(characterBuffer, textRun.Length, shaperOptions);
- return new ShapedTextCharacters(shapedBuffer, textRun.Properties);
+ return new ShapedTextRun(shapedBuffer, textRun.Properties);
}
}
}
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextLeadingPrefixCharacterEllipsis.cs b/src/Avalonia.Base/Media/TextFormatting/TextLeadingPrefixCharacterEllipsis.cs
index 2752af8f0c..7b80d5ce40 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextLeadingPrefixCharacterEllipsis.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextLeadingPrefixCharacterEllipsis.cs
@@ -65,7 +65,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
currentWidth += currentRun.Size.Width;
@@ -118,7 +118,7 @@ namespace Avalonia.Media.TextFormatting
switch (run)
{
- case ShapedTextCharacters endShapedRun:
+ case ShapedTextRun endShapedRun:
{
if (endShapedRun.TryMeasureCharactersBackwards(availableSuffixWidth,
out var suffixCount, out var suffixWidth))
diff --git a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
index d893468052..5fb1171221 100644
--- a/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
@@ -192,14 +192,14 @@ namespace Avalonia.Media.TextFormatting
{
var currentRun = _textRuns[i];
- if (currentRun is ShapedTextCharacters shapedRun && !shapedRun.ShapedBuffer.IsLeftToRight)
+ if (currentRun is ShapedTextRun shapedRun && !shapedRun.ShapedBuffer.IsLeftToRight)
{
var rightToLeftIndex = i;
currentPosition += currentRun.Length;
while (rightToLeftIndex + 1 <= _textRuns.Count - 1)
{
- var nextShaped = _textRuns[++rightToLeftIndex] as ShapedTextCharacters;
+ var nextShaped = _textRuns[++rightToLeftIndex] as ShapedTextRun;
if (nextShaped == null || nextShaped.ShapedBuffer.IsLeftToRight)
{
@@ -255,7 +255,7 @@ namespace Avalonia.Media.TextFormatting
switch (run)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
characterHit = shapedRun.GlyphRun.GetCharacterHitFromDistance(distance, out _);
@@ -303,7 +303,7 @@ namespace Avalonia.Media.TextFormatting
{
var currentRun = _textRuns[index];
- if (currentRun is ShapedTextCharacters shapedRun && !shapedRun.ShapedBuffer.IsLeftToRight)
+ if (currentRun is ShapedTextRun shapedRun && !shapedRun.ShapedBuffer.IsLeftToRight)
{
var i = index;
@@ -313,7 +313,7 @@ namespace Avalonia.Media.TextFormatting
{
var nextRun = _textRuns[i + 1];
- if (nextRun is ShapedTextCharacters nextShapedRun && !nextShapedRun.ShapedBuffer.IsLeftToRight)
+ if (nextRun is ShapedTextRun nextShapedRun && !nextShapedRun.ShapedBuffer.IsLeftToRight)
{
i++;
@@ -407,7 +407,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedTextCharacters:
+ case ShapedTextRun shapedTextCharacters:
{
currentGlyphRun = shapedTextCharacters.GlyphRun;
@@ -476,7 +476,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
nextCharacterHit = shapedRun.GlyphRun.GetNextCaretCharacterHit(characterHit);
break;
@@ -550,7 +550,7 @@ namespace Avalonia.Media.TextFormatting
double combinedWidth;
- if (currentRun is ShapedTextCharacters currentShapedRun)
+ if (currentRun is ShapedTextRun currentShapedRun)
{
var firstCluster = currentShapedRun.GlyphRun.Metrics.FirstCluster;
@@ -592,7 +592,7 @@ namespace Avalonia.Media.TextFormatting
var rightToLeftIndex = index;
var rightToLeftWidth = currentShapedRun.Size.Width;
- while (rightToLeftIndex + 1 <= _textRuns.Count - 1 && _textRuns[rightToLeftIndex + 1] is ShapedTextCharacters nextShapedRun)
+ while (rightToLeftIndex + 1 <= _textRuns.Count - 1 && _textRuns[rightToLeftIndex + 1] is ShapedTextRun nextShapedRun)
{
if (nextShapedRun == null || nextShapedRun.ShapedBuffer.IsLeftToRight)
{
@@ -624,12 +624,12 @@ namespace Avalonia.Media.TextFormatting
for (int i = rightToLeftIndex - 1; i >= index; i--)
{
- if (TextRuns[i] is not ShapedTextCharacters)
+ if (TextRuns[i] is not ShapedTextRun)
{
continue;
}
- currentShapedRun = (ShapedTextCharacters)TextRuns[i];
+ currentShapedRun = (ShapedTextRun)TextRuns[i];
currentRunBounds = GetRightToLeftTextRunBounds(currentShapedRun, startX, firstTextSourceIndex, characterIndex, currentPosition, remainingLength);
@@ -769,7 +769,7 @@ namespace Avalonia.Media.TextFormatting
var characterLength = 0;
var endX = startX;
- if (currentRun is ShapedTextCharacters currentShapedRun)
+ if (currentRun is ShapedTextRun currentShapedRun)
{
var offset = Math.Max(0, firstTextSourceIndex - currentPosition);
@@ -883,7 +883,7 @@ namespace Avalonia.Media.TextFormatting
return result;
}
- private TextRunBounds GetRightToLeftTextRunBounds(ShapedTextCharacters currentRun, double endX, int firstTextSourceIndex, int characterIndex, int currentPosition, int remainingLength)
+ private TextRunBounds GetRightToLeftTextRunBounds(ShapedTextRun currentRun, double endX, int firstTextSourceIndex, int characterIndex, int currentPosition, int remainingLength)
{
var startX = endX;
@@ -945,7 +945,7 @@ namespace Avalonia.Media.TextFormatting
private static sbyte GetRunBidiLevel(DrawableTextRun run, FlowDirection flowDirection)
{
- if (run is ShapedTextCharacters shapedTextCharacters)
+ if (run is ShapedTextRun shapedTextCharacters)
{
return shapedTextCharacters.BidiLevel;
}
@@ -1027,7 +1027,7 @@ namespace Avalonia.Media.TextFormatting
{
if (current.Level >= minLevelToReverse && current.Level % 2 != 0)
{
- if (current.Run is ShapedTextCharacters { IsReversed: false } shapedTextCharacters)
+ if (current.Run is ShapedTextRun { IsReversed: false } shapedTextCharacters)
{
shapedTextCharacters.Reverse();
}
@@ -1145,7 +1145,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
var foundCharacterHit = shapedRun.GlyphRun.FindNearestCharacterHit(characterHit.FirstCharacterIndex + characterHit.TrailingLength, out _);
@@ -1230,7 +1230,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
var foundCharacterHit = shapedRun.GlyphRun.FindNearestCharacterHit(characterHit.FirstCharacterIndex - 1, out _);
@@ -1294,7 +1294,7 @@ namespace Avalonia.Media.TextFormatting
switch (currentRun)
{
- case ShapedTextCharacters shapedRun:
+ case ShapedTextRun shapedRun:
{
var firstCluster = shapedRun.GlyphRun.Metrics.FirstCluster;
@@ -1303,7 +1303,7 @@ namespace Avalonia.Media.TextFormatting
break;
}
- if (previousRun is ShapedTextCharacters previousShaped && !previousShaped.ShapedBuffer.IsLeftToRight)
+ if (previousRun is ShapedTextRun previousShaped && !previousShaped.ShapedBuffer.IsLeftToRight)
{
if (shapedRun.ShapedBuffer.IsLeftToRight)
{
@@ -1394,7 +1394,7 @@ namespace Avalonia.Media.TextFormatting
{
switch (_textRuns[index])
{
- case ShapedTextCharacters textRun:
+ case ShapedTextRun textRun:
{
var textMetrics =
new TextMetrics(textRun.Properties.Typeface.GlyphTypeface, textRun.Properties.FontRenderingEmSize);
diff --git a/src/Avalonia.Base/Media/TextFormatting/ShapeableTextCharacters.cs b/src/Avalonia.Base/Media/TextFormatting/UnshapedTextRun.cs
similarity index 61%
rename from src/Avalonia.Base/Media/TextFormatting/ShapeableTextCharacters.cs
rename to src/Avalonia.Base/Media/TextFormatting/UnshapedTextRun.cs
index 0e8d6e3e4a..817086db88 100644
--- a/src/Avalonia.Base/Media/TextFormatting/ShapeableTextCharacters.cs
+++ b/src/Avalonia.Base/Media/TextFormatting/UnshapedTextRun.cs
@@ -5,9 +5,9 @@ namespace Avalonia.Media.TextFormatting
///
/// A group of characters that can be shaped.
///
- public sealed class ShapeableTextCharacters : TextRun
+ public sealed class UnshapedTextRun : TextRun
{
- public ShapeableTextCharacters(CharacterBufferReference characterBufferReference, int length,
+ public UnshapedTextRun(CharacterBufferReference characterBufferReference, int length,
TextRunProperties properties, sbyte biDiLevel)
{
CharacterBufferReference = characterBufferReference;
@@ -24,30 +24,30 @@ namespace Avalonia.Media.TextFormatting
public sbyte BidiLevel { get; }
- public bool CanShapeTogether(ShapeableTextCharacters shapeableTextCharacters)
+ public bool CanShapeTogether(UnshapedTextRun unshapedTextRun)
{
- if (!CharacterBufferReference.Equals(shapeableTextCharacters.CharacterBufferReference))
+ if (!CharacterBufferReference.Equals(unshapedTextRun.CharacterBufferReference))
{
return false;
}
- if (BidiLevel != shapeableTextCharacters.BidiLevel)
+ if (BidiLevel != unshapedTextRun.BidiLevel)
{
return false;
}
if (!MathUtilities.AreClose(Properties.FontRenderingEmSize,
- shapeableTextCharacters.Properties.FontRenderingEmSize))
+ unshapedTextRun.Properties.FontRenderingEmSize))
{
return false;
}
- if (Properties.Typeface != shapeableTextCharacters.Properties.Typeface)
+ if (Properties.Typeface != unshapedTextRun.Properties.Typeface)
{
return false;
}
- if (Properties.BaselineAlignment != shapeableTextCharacters.Properties.BaselineAlignment)
+ if (Properties.BaselineAlignment != unshapedTextRun.Properties.BaselineAlignment)
{
return false;
}
diff --git a/src/Avalonia.Base/Rendering/Composition/Compositor.cs b/src/Avalonia.Base/Rendering/Composition/Compositor.cs
index b4817bfe9a..7fc5487171 100644
--- a/src/Avalonia.Base/Rendering/Composition/Compositor.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Compositor.cs
@@ -111,7 +111,7 @@ namespace Avalonia.Rendering.Composition
}
}
- batch.CommitedAt = Server.Clock.Elapsed;
+ batch.CommittedAt = Server.Clock.Elapsed;
_server.EnqueueBatch(batch);
lock (_pendingBatchLock)
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs
index 8dc088fed1..aebe3a5cdd 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionDrawListVisual.cs
@@ -48,7 +48,7 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua
}
}
- protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt)
+ protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan committedAt)
{
if (reader.Read() == 1)
{
@@ -56,7 +56,7 @@ internal class ServerCompositionDrawListVisual : ServerCompositionContainerVisua
_renderCommands = reader.ReadObject();
_contentBounds = null;
}
- base.DeserializeChangesCore(reader, commitedAt);
+ base.DeserializeChangesCore(reader, committedAt);
}
protected override void RenderCore(CompositorDrawingContextProxy canvas, Rect currentTransformedClip)
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomCompositionVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomCompositionVisual.cs
index 227df87a87..74889c9bfe 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomCompositionVisual.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCustomCompositionVisual.cs
@@ -16,9 +16,9 @@ internal class ServerCompositionCustomVisual : ServerCompositionContainerVisual,
_handler.Attach(this);
}
- protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt)
+ protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan committedAt)
{
- base.DeserializeChangesCore(reader, commitedAt);
+ base.DeserializeChangesCore(reader, committedAt);
var count = reader.Read();
for (var c = 0; c < count; c++)
{
@@ -79,4 +79,4 @@ internal class ServerCompositionCustomVisual : ServerCompositionContainerVisual,
?.Log(_handler, $"Exception in {_handler.GetType().Name}.{nameof(CompositionCustomVisualHandler.OnRender)} {{0}}", e);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs
index 08a3fdce22..2500358866 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerList.cs
@@ -14,7 +14,7 @@ namespace Avalonia.Rendering.Composition.Server
{
public List List { get; } = new List();
- protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt)
+ protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan committedAt)
{
if (reader.Read() == 1)
{
@@ -23,7 +23,7 @@ namespace Avalonia.Rendering.Composition.Server
for (var c = 0; c < count; c++)
List.Add(reader.ReadObject());
}
- base.DeserializeChangesCore(reader, commitedAt);
+ base.DeserializeChangesCore(reader, committedAt);
}
public override long LastChangedBy
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs
index 257d3b29a2..31cb16ec20 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerObject.cs
@@ -104,13 +104,13 @@ namespace Avalonia.Rendering.Composition.Server
}
protected void SetAnimatedValue(CompositionProperty prop, ref T field,
- TimeSpan commitedAt, IAnimationInstance animation) where T : struct
+ TimeSpan committedAt, IAnimationInstance animation) where T : struct
{
if (IsActive && _animations.TryGetValue(prop, out var oldAnimation))
oldAnimation.Deactivate();
_animations[prop] = animation;
- animation.Initialize(commitedAt, ExpressionVariant.Create(field), prop);
+ animation.Initialize(committedAt, ExpressionVariant.Create(field), prop);
if(IsActive)
animation.Activate();
@@ -165,7 +165,7 @@ namespace Avalonia.Rendering.Composition.Server
public virtual CompositionProperty? GetCompositionProperty(string fieldName) => null;
- protected virtual void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt)
+ protected virtual void DeserializeChangesCore(BatchStreamReader reader, TimeSpan committedAt)
{
if (this is IDisposable disp
&& reader.Read() == 1)
@@ -174,7 +174,7 @@ namespace Avalonia.Rendering.Composition.Server
public void DeserializeChanges(BatchStreamReader reader, Batch batch)
{
- DeserializeChangesCore(reader, batch.CommitedAt);
+ DeserializeChangesCore(reader, batch.CommittedAt);
ValuesInvalidated();
ItselfLastChangedBy = batch.SequenceId;
}
diff --git a/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs
index d3e3664f84..803ea809c0 100644
--- a/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Transport/Batch.cs
@@ -29,7 +29,7 @@ namespace Avalonia.Rendering.Composition.Transport
public BatchStreamData Changes { get; private set; }
- public TimeSpan CommitedAt { get; set; }
+ public TimeSpan CommittedAt { get; set; }
public void Complete()
{
diff --git a/src/Avalonia.Build.Tasks/ComInteropHelper.cs b/src/Avalonia.Build.Tasks/ComInteropHelper.cs
index 007231417d..c990741e1e 100644
--- a/src/Avalonia.Build.Tasks/ComInteropHelper.cs
+++ b/src/Avalonia.Build.Tasks/ComInteropHelper.cs
@@ -65,10 +65,8 @@ namespace Avalonia.Build.Tasks
{
Instruction instruction = instructions[i];
- if (instruction.OpCode == OpCodes.Call && instruction.Operand is MethodReference)
+ if (instruction.OpCode == OpCodes.Call && instruction.Operand is MethodReference methodDescription)
{
- var methodDescription = (MethodReference)instruction.Operand;
-
if (methodDescription.Name.StartsWith("Calli") && methodDescription.DeclaringType.Name == "LocalInterop")
{
var callSite = new CallSite(methodDescription.ReturnType) { CallingConvention = MethodCallingConvention.StdCall };
diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs
index 2cc5b99b2e..aaf272c6d2 100644
--- a/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs
+++ b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatColorPalette.cs
@@ -289,8 +289,8 @@ namespace Avalonia.Controls
};
// See: https://htmlcolorcodes.com/assets/downloads/flat-design-colors/flat-design-color-chart.png
- protected static Color[,]? _colorChart = null;
- protected static object _colorChartMutex = new object();
+ private static Color[,]? _colorChart = null;
+ private static readonly object _colorChartMutex = new();
///
/// Initializes all color chart colors.
diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs
index 2758124fae..4a30fb6cb4 100644
--- a/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs
+++ b/src/Avalonia.Controls.ColorPicker/ColorPalettes/FlatHalfColorPalette.cs
@@ -10,8 +10,8 @@ namespace Avalonia.Controls
///
public class FlatHalfColorPalette : IColorPalette
{
- protected static Color[,]? _colorChart = null;
- protected static object _colorChartMutex = new object();
+ private static Color[,]? _colorChart = null;
+ private static readonly object _colorChartMutex = new();
///
/// Initializes all color chart colors.
diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs
index d009926bc5..d4b904163c 100644
--- a/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs
+++ b/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialColorPalette.cs
@@ -344,8 +344,8 @@ namespace Avalonia.Controls
// See: https://material.io/design/color/the-color-system.html#tools-for-picking-colors
// This is a reduced palette for uniformity
- protected static Color[,]? _colorChart = null;
- protected static object _colorChartMutex = new object();
+ private static Color[,]? _colorChart = null;
+ private static readonly object _colorChartMutex = new();
///
/// Initializes all color chart colors.
diff --git a/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs b/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs
index 01d44aa65d..4432642675 100644
--- a/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs
+++ b/src/Avalonia.Controls.ColorPicker/ColorPalettes/MaterialHalfColorPalette.cs
@@ -10,8 +10,8 @@ namespace Avalonia.Controls
///
public class MaterialHalfColorPalette : IColorPalette
{
- protected static Color[,]? _colorChart = null;
- protected static object _colorChartMutex = new object();
+ private static Color[,]? _colorChart = null;
+ private static readonly object _colorChartMutex = new();
///
/// Initializes all color chart colors.
diff --git a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
index c308312398..39c1e4c118 100644
--- a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
@@ -31,7 +31,7 @@ namespace Avalonia.Controls
///
/// Defines the property.
///
- public static StyledProperty IsThreeStateProperty =
+ public static readonly StyledProperty IsThreeStateProperty =
CheckBox.IsThreeStateProperty.AddOwner();
///
diff --git a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
index d9d80acdc3..f7df3d493a 100644
--- a/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGridColumn.cs
@@ -185,7 +185,7 @@ namespace Avalonia.Controls
///
/// Defines the property.
///
- public static StyledProperty IsVisibleProperty =
+ public static readonly StyledProperty IsVisibleProperty =
Control.IsVisibleProperty.AddOwner();
///
diff --git a/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
index e0d986f2b4..f9978d2795 100644
--- a/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
+++ b/src/Avalonia.Controls/AutoCompleteBox/AutoCompleteBox.cs
@@ -474,6 +474,7 @@ namespace Avalonia.Controls
FilterModeProperty.Changed.AddClassHandler((x,e) => x.OnFilterModePropertyChanged(e));
ItemFilterProperty.Changed.AddClassHandler((x,e) => x.OnItemFilterPropertyChanged(e));
ItemsProperty.Changed.AddClassHandler((x,e) => x.OnItemsPropertyChanged(e));
+ ItemTemplateProperty.Changed.AddClassHandler((x,e) => x.OnItemTemplatePropertyChanged(e));
IsEnabledProperty.Changed.AddClassHandler((x,e) => x.OnControlIsEnabledChanged(e));
}
diff --git a/src/Avalonia.Controls/BorderVisual.cs b/src/Avalonia.Controls/BorderVisual.cs
index 18448edac4..b0e5c30e2f 100644
--- a/src/Avalonia.Controls/BorderVisual.cs
+++ b/src/Avalonia.Controls/BorderVisual.cs
@@ -63,9 +63,9 @@ class CompositionBorderVisual : CompositionDrawListVisual
}
- protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan commitedAt)
+ protected override void DeserializeChangesCore(BatchStreamReader reader, TimeSpan committedAt)
{
- base.DeserializeChangesCore(reader, commitedAt);
+ base.DeserializeChangesCore(reader, committedAt);
if (reader.Read())
_cornerRadius = reader.Read();
}
diff --git a/src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs b/src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs
index 9fddb91231..343b628fb9 100644
--- a/src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs
+++ b/src/Avalonia.Controls/Diagnostics/ToolTipDiagnostics.cs
@@ -8,6 +8,6 @@
///
/// Provides access to the internal for use in DevTools.
///
- public static AvaloniaProperty ToolTipProperty = ToolTip.ToolTipProperty;
+ public static readonly AvaloniaProperty ToolTipProperty = ToolTip.ToolTipProperty;
}
}
diff --git a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
index 328facba0b..61ad5e802b 100644
--- a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
+++ b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs
@@ -94,6 +94,7 @@ namespace Avalonia.Controls.Presenters
{
AddHandler(RequestBringIntoViewEvent, BringIntoViewRequested);
AddHandler(Gestures.ScrollGestureEvent, OnScrollGesture);
+ AddHandler(Gestures.ScrollGestureEndedEvent, OnScrollGestureEnded);
this.GetObservable(ChildProperty).Subscribe(UpdateScrollableSubscription);
}
diff --git a/src/Avalonia.Controls/PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter.cs b/src/Avalonia.Controls/PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter.cs
index c3aebc82c5..844973bd28 100644
--- a/src/Avalonia.Controls/PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter.cs
+++ b/src/Avalonia.Controls/PullToRefresh/ScrollViewerIRefreshInfoProviderAdapter.cs
@@ -197,12 +197,12 @@ namespace Avalonia.Controls.PullToRefresh
throw new ArgumentException(nameof(_scrollViewer), "Adaptee's content property must be a Visual");
}
- if (content.Parent is not InputElement)
+ if (content.Parent is not InputElement parent)
{
throw new ArgumentException(nameof(_scrollViewer), "Adaptee's content parent must be an InputElement");
}
- MakeInteractionSource(content.Parent as InputElement);
+ MakeInteractionSource(parent);
if (_scrollViewer != null)
{
diff --git a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs
index d4ecdd6cf0..a093d976f7 100644
--- a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs
+++ b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs
@@ -59,7 +59,7 @@ namespace Avalonia.Controls.Templates
/// The untyped function.
private static Func