diff --git a/src/Avalonia.Base/AvaloniaLocator.cs b/src/Avalonia.Base/AvaloniaLocator.cs index cd398c53ed..f9bbe38bec 100644 --- a/src/Avalonia.Base/AvaloniaLocator.cs +++ b/src/Avalonia.Base/AvaloniaLocator.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Reactive.Disposables; #pragma warning disable CS1591 // Enable me later diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs index 35e189e6a4..7e8d733f1b 100644 --- a/src/Avalonia.Base/AvaloniaObject.cs +++ b/src/Avalonia.Base/AvaloniaObject.cs @@ -5,12 +5,10 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using System.Reactive.Disposables; using System.Reactive.Linq; using Avalonia.Data; using Avalonia.Diagnostics; using Avalonia.Logging; -using Avalonia.Reactive; using Avalonia.Threading; using Avalonia.Utilities; diff --git a/src/Avalonia.Base/AvaloniaProperty.cs b/src/Avalonia.Base/AvaloniaProperty.cs index f7dabd3a43..4b0116a536 100644 --- a/src/Avalonia.Base/AvaloniaProperty.cs +++ b/src/Avalonia.Base/AvaloniaProperty.cs @@ -231,7 +231,7 @@ namespace Avalonia } /// - /// Tests two s for unequality. + /// Tests two s for inequality. /// /// The first property. /// The second property. @@ -558,4 +558,4 @@ namespace Avalonia public override string ToString() => "(unset)"; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Collections/AvaloniaList.cs b/src/Avalonia.Base/Collections/AvaloniaList.cs index 41c2ad6e54..d5a4e63003 100644 --- a/src/Avalonia.Base/Collections/AvaloniaList.cs +++ b/src/Avalonia.Base/Collections/AvaloniaList.cs @@ -8,7 +8,6 @@ using System.Collections.Specialized; using System.ComponentModel; using System.Linq; using Avalonia.Diagnostics; -using Avalonia.Platform; namespace Avalonia.Collections { @@ -551,4 +550,4 @@ namespace Avalonia.Collections NotifyCountChanged(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Collections/AvaloniaListConverter.cs b/src/Avalonia.Base/Collections/AvaloniaListConverter.cs index 7f5442857c..63c2e07ecf 100644 --- a/src/Avalonia.Base/Collections/AvaloniaListConverter.cs +++ b/src/Avalonia.Base/Collections/AvaloniaListConverter.cs @@ -40,4 +40,4 @@ namespace Avalonia.Collections return result; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Collections/AvaloniaListExtensions.cs b/src/Avalonia.Base/Collections/AvaloniaListExtensions.cs index b27b06a277..1731950222 100644 --- a/src/Avalonia.Base/Collections/AvaloniaListExtensions.cs +++ b/src/Avalonia.Base/Collections/AvaloniaListExtensions.cs @@ -6,7 +6,6 @@ using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; -using System.Linq; using System.Reactive.Disposables; namespace Avalonia.Collections diff --git a/src/Avalonia.Base/Collections/IAvaloniaList.cs b/src/Avalonia.Base/Collections/IAvaloniaList.cs index 48c36976a5..b7ed9b1ad6 100644 --- a/src/Avalonia.Base/Collections/IAvaloniaList.cs +++ b/src/Avalonia.Base/Collections/IAvaloniaList.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; namespace Avalonia.Collections { /// - /// A notiftying list. + /// A notifying list. /// /// The type of the items in the list. public interface IAvaloniaList : IList, IAvaloniaReadOnlyList @@ -64,4 +64,4 @@ namespace Avalonia.Collections /// The number of items to remove. void RemoveRange(int index, int count); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs b/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs index 1aa4ff34d5..755efa3eaf 100644 --- a/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs +++ b/src/Avalonia.Base/Collections/IAvaloniaReadOnlyList.cs @@ -8,10 +8,10 @@ using System.ComponentModel; namespace Avalonia.Collections { /// - /// A read-only notiftying list. + /// A read-only notifying list. /// /// The type of the items in the list. public interface IAvaloniaReadOnlyList : IReadOnlyList, INotifyCollectionChanged, INotifyPropertyChanged { } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs b/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs index 3a355bcb48..ba84c37e4a 100644 --- a/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs +++ b/src/Avalonia.Base/Collections/NotifyCollectionChangedExtensions.cs @@ -25,7 +25,7 @@ namespace Avalonia.Collections } /// - /// Subcribes to the CollectionChanged event using a weak subscription. + /// Subscribes to the CollectionChanged event using a weak subscription. /// /// The collection. /// @@ -44,7 +44,7 @@ namespace Avalonia.Collections } /// - /// Subcribes to the CollectionChanged event using a weak subscription. + /// Subscribes to the CollectionChanged event using a weak subscription. /// /// The collection. /// diff --git a/src/Avalonia.Base/Data/BindingChainException.cs b/src/Avalonia.Base/Data/BindingChainException.cs index 97b0d3ba8b..a609ace4ec 100644 --- a/src/Avalonia.Base/Data/BindingChainException.cs +++ b/src/Avalonia.Base/Data/BindingChainException.cs @@ -6,7 +6,7 @@ using System; namespace Avalonia.Data { /// - /// An exception returned through signalling that a + /// An exception returned through signaling that a /// requested binding expression could not be evaluated because of a null in one of the links /// of the binding chain. /// @@ -15,14 +15,14 @@ namespace Avalonia.Data private string _message; /// - /// Initalizes a new instance of the class. + /// Initializes a new instance of the class. /// public BindingChainException() { } /// - /// Initalizes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error message. public BindingChainException(string message) @@ -31,7 +31,7 @@ namespace Avalonia.Data } /// - /// Initalizes a new instance of the class. + /// Initializes a new instance of the class. /// /// The error message. /// The expression. @@ -51,7 +51,7 @@ namespace Avalonia.Data public string Expression { get; protected set; } /// - /// Gets the point in the expression at which the error occured. + /// Gets the point in the expression at which the error occurred. /// public string ExpressionErrorPoint { get; protected set; } diff --git a/src/Avalonia.Base/Data/BindingNotification.cs b/src/Avalonia.Base/Data/BindingNotification.cs index 5d3e6b26f4..7c55321a80 100644 --- a/src/Avalonia.Base/Data/BindingNotification.cs +++ b/src/Avalonia.Base/Data/BindingNotification.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using Avalonia.Logging; namespace Avalonia.Data { diff --git a/src/Avalonia.Base/Data/BindingOperations.cs b/src/Avalonia.Base/Data/BindingOperations.cs index eb7c449bec..ca148659e6 100644 --- a/src/Avalonia.Base/Data/BindingOperations.cs +++ b/src/Avalonia.Base/Data/BindingOperations.cs @@ -20,7 +20,7 @@ namespace Avalonia.Data /// An optional anchor from which to locate required context. When binding to objects that /// are not in the logical tree, certain types of binding need an anchor into the tree in /// order to locate named controls or resources. The parameter - /// can be used to provice this context. + /// can be used to provide this context. /// /// An which can be used to cancel the binding. public static IDisposable Apply( diff --git a/src/Avalonia.Base/Data/Converters/AlwaysEnabledDelegateCommand.cs b/src/Avalonia.Base/Data/Converters/AlwaysEnabledDelegateCommand.cs index d2fb48ffb8..7f4c83772d 100644 --- a/src/Avalonia.Base/Data/Converters/AlwaysEnabledDelegateCommand.cs +++ b/src/Avalonia.Base/Data/Converters/AlwaysEnabledDelegateCommand.cs @@ -1,10 +1,8 @@ -using Avalonia.Utilities; -using System; -using System.Collections.Generic; +using System; using System.Globalization; using System.Reflection; -using System.Text; using System.Windows.Input; +using Avalonia.Utilities; namespace Avalonia.Data.Converters { diff --git a/src/Avalonia.Base/Data/Converters/DefaultValueConverter.cs b/src/Avalonia.Base/Data/Converters/DefaultValueConverter.cs index ec75076892..990a4b04f2 100644 --- a/src/Avalonia.Base/Data/Converters/DefaultValueConverter.cs +++ b/src/Avalonia.Base/Data/Converters/DefaultValueConverter.cs @@ -3,9 +3,8 @@ using System; using System.Globalization; -using Avalonia.Data; -using Avalonia.Utilities; using System.Windows.Input; +using Avalonia.Utilities; namespace Avalonia.Data.Converters { diff --git a/src/Avalonia.Base/Data/Converters/IValueConverter.cs b/src/Avalonia.Base/Data/Converters/IValueConverter.cs index b55a2c4fe8..754aa7975d 100644 --- a/src/Avalonia.Base/Data/Converters/IValueConverter.cs +++ b/src/Avalonia.Base/Data/Converters/IValueConverter.cs @@ -3,7 +3,6 @@ using System; using System.Globalization; -using Avalonia.Data; namespace Avalonia.Data.Converters { diff --git a/src/Avalonia.Base/Data/Converters/StringConverters.cs b/src/Avalonia.Base/Data/Converters/StringConverters.cs index 470f0d2289..0101cf5d29 100644 --- a/src/Avalonia.Base/Data/Converters/StringConverters.cs +++ b/src/Avalonia.Base/Data/Converters/StringConverters.cs @@ -1,9 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Globalization; -using Avalonia.Utilities; namespace Avalonia.Data.Converters { diff --git a/src/Avalonia.Base/Data/Core/AvaloniaPropertyAccessorNode.cs b/src/Avalonia.Base/Data/Core/AvaloniaPropertyAccessorNode.cs index f7e5de2fe2..28c0dce518 100644 --- a/src/Avalonia.Base/Data/Core/AvaloniaPropertyAccessorNode.cs +++ b/src/Avalonia.Base/Data/Core/AvaloniaPropertyAccessorNode.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Reactive.Linq; -using System.Text; using Avalonia.Reactive; namespace Avalonia.Data.Core diff --git a/src/Avalonia.Base/Data/Core/EmptyExpressionNode.cs b/src/Avalonia.Base/Data/Core/EmptyExpressionNode.cs index 0e2c3c035c..d5658b124b 100644 --- a/src/Avalonia.Base/Data/Core/EmptyExpressionNode.cs +++ b/src/Avalonia.Base/Data/Core/EmptyExpressionNode.cs @@ -1,9 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Reactive.Linq; - namespace Avalonia.Data.Core { public class EmptyExpressionNode : ExpressionNode diff --git a/src/Avalonia.Base/Data/Core/ExpressionObserver.cs b/src/Avalonia.Base/Data/Core/ExpressionObserver.cs index 773049d3a5..65f26df011 100644 --- a/src/Avalonia.Base/Data/Core/ExpressionObserver.cs +++ b/src/Avalonia.Base/Data/Core/ExpressionObserver.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reactive; using System.Reactive.Linq; -using Avalonia.Data; using Avalonia.Data.Core.Parsers; using Avalonia.Data.Core.Plugins; using Avalonia.Reactive; diff --git a/src/Avalonia.Base/Data/Core/ExpressionParseException.cs b/src/Avalonia.Base/Data/Core/ExpressionParseException.cs index 195c9b7660..0365ead24d 100644 --- a/src/Avalonia.Base/Data/Core/ExpressionParseException.cs +++ b/src/Avalonia.Base/Data/Core/ExpressionParseException.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using Avalonia.Data.Core.Parsers; namespace Avalonia.Data.Core { diff --git a/src/Avalonia.Base/Data/Core/ITransformNode.cs b/src/Avalonia.Base/Data/Core/ITransformNode.cs index 7638db8302..843d09fc19 100644 --- a/src/Avalonia.Base/Data/Core/ITransformNode.cs +++ b/src/Avalonia.Base/Data/Core/ITransformNode.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Avalonia.Data.Core +namespace Avalonia.Data.Core { interface ITransformNode { diff --git a/src/Avalonia.Base/Data/Core/IndexerExpressionNode.cs b/src/Avalonia.Base/Data/Core/IndexerExpressionNode.cs index 04412b61ef..4206a99e3d 100644 --- a/src/Avalonia.Base/Data/Core/IndexerExpressionNode.cs +++ b/src/Avalonia.Base/Data/Core/IndexerExpressionNode.cs @@ -3,8 +3,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Linq.Expressions; using System.Reflection; -using System.Text; -using Avalonia.Data; namespace Avalonia.Data.Core { diff --git a/src/Avalonia.Base/Data/Core/IndexerNodeBase.cs b/src/Avalonia.Base/Data/Core/IndexerNodeBase.cs index 5c3295a9d8..5e09bbcc2f 100644 --- a/src/Avalonia.Base/Data/Core/IndexerNodeBase.cs +++ b/src/Avalonia.Base/Data/Core/IndexerNodeBase.cs @@ -3,12 +3,8 @@ using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; -using System.Globalization; using System.Linq; using System.Reactive.Linq; -using System.Reflection; -using System.Text; -using Avalonia.Data; using Avalonia.Utilities; namespace Avalonia.Data.Core diff --git a/src/Avalonia.Base/Data/Core/LogicalNotNode.cs b/src/Avalonia.Base/Data/Core/LogicalNotNode.cs index 20f1bcd21e..6d58b18a9f 100644 --- a/src/Avalonia.Base/Data/Core/LogicalNotNode.cs +++ b/src/Avalonia.Base/Data/Core/LogicalNotNode.cs @@ -3,7 +3,6 @@ using System; using System.Globalization; -using Avalonia.Data; namespace Avalonia.Data.Core { diff --git a/src/Avalonia.Base/Data/Core/Parsers/ExpressionTreeParser.cs b/src/Avalonia.Base/Data/Core/Parsers/ExpressionTreeParser.cs index db5d117687..d2035a592f 100644 --- a/src/Avalonia.Base/Data/Core/Parsers/ExpressionTreeParser.cs +++ b/src/Avalonia.Base/Data/Core/Parsers/ExpressionTreeParser.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Linq.Expressions; -using System.Text; namespace Avalonia.Data.Core.Parsers { diff --git a/src/Avalonia.Base/Data/Core/Parsers/ExpressionVisitorNodeBuilder.cs b/src/Avalonia.Base/Data/Core/Parsers/ExpressionVisitorNodeBuilder.cs index 1b4d1c200d..bcb6eeca41 100644 --- a/src/Avalonia.Base/Data/Core/Parsers/ExpressionVisitorNodeBuilder.cs +++ b/src/Avalonia.Base/Data/Core/Parsers/ExpressionVisitorNodeBuilder.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; -using System.Text; namespace Avalonia.Data.Core.Parsers { diff --git a/src/Avalonia.Base/Data/Core/Plugins/AvaloniaPropertyAccessorPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/AvaloniaPropertyAccessorPlugin.cs index ee91f964ff..8d2ed905ee 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/AvaloniaPropertyAccessorPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/AvaloniaPropertyAccessorPlugin.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Linq; using System.Reactive.Linq; -using Avalonia.Data; namespace Avalonia.Data.Core.Plugins { diff --git a/src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs index 47e4d91e13..33c40abea8 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/DataAnnotationsValidationPlugin.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; -using Avalonia.Data; namespace Avalonia.Data.Core.Plugins { @@ -31,7 +30,7 @@ namespace Avalonia.Data.Core.Plugins return new Accessor(reference, name, inner); } - private class Accessor : DataValidatiorBase + private class Accessor : DataValidationBase { private ValidationContext _context; diff --git a/src/Avalonia.Base/Data/Core/Plugins/DataValidatiorBase.cs b/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs similarity index 95% rename from src/Avalonia.Base/Data/Core/Plugins/DataValidatiorBase.cs rename to src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs index 03ab7712bd..faec981eed 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/DataValidatiorBase.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/DataValidationBase.cs @@ -15,15 +15,15 @@ namespace Avalonia.Data.Core.Plugins /// and convert any values received from the inner property accessor into /// s. /// - public abstract class DataValidatiorBase : PropertyAccessorBase, IObserver + public abstract class DataValidationBase : PropertyAccessorBase, IObserver { private readonly IPropertyAccessor _inner; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The inner property accessor. - protected DataValidatiorBase(IPropertyAccessor inner) + protected DataValidationBase(IPropertyAccessor inner) { _inner = inner; } @@ -77,4 +77,4 @@ namespace Avalonia.Data.Core.Plugins PublishValue(notification); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Data/Core/Plugins/ExceptionValidationPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/ExceptionValidationPlugin.cs index 4507b32e0c..eabfa31d4b 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/ExceptionValidationPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/ExceptionValidationPlugin.cs @@ -20,7 +20,7 @@ namespace Avalonia.Data.Core.Plugins return new Validator(reference, name, inner); } - private class Validator : DataValidatiorBase + private class Validator : DataValidationBase { public Validator(WeakReference reference, string name, IPropertyAccessor inner) : base(inner) diff --git a/src/Avalonia.Base/Data/Core/Plugins/IDataValidationPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/IDataValidationPlugin.cs index c55917b088..2c3a9a53b4 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/IDataValidationPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/IDataValidationPlugin.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using Avalonia.Data; namespace Avalonia.Data.Core.Plugins { diff --git a/src/Avalonia.Base/Data/Core/Plugins/IndeiValidationPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/IndeiValidationPlugin.cs index 4d6fc01229..2e83e0c25e 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/IndeiValidationPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/IndeiValidationPlugin.cs @@ -23,7 +23,7 @@ namespace Avalonia.Data.Core.Plugins return new Validator(reference, name, accessor); } - private class Validator : DataValidatiorBase, IWeakSubscriber + private class Validator : DataValidationBase, IWeakSubscriber { WeakReference _reference; string _name; diff --git a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs index dab32b639a..4047489ccc 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/InpcPropertyAccessorPlugin.cs @@ -6,8 +6,6 @@ using System.ComponentModel; using System.Linq; using System.Reactive.Linq; using System.Reflection; -using Avalonia.Data; -using Avalonia.Logging; using Avalonia.Utilities; namespace Avalonia.Data.Core.Plugins diff --git a/src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs index cf0abc6f35..135935498c 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs @@ -1,9 +1,6 @@ using System; -using System.Collections.Generic; -using System.Text; -using Avalonia.Data; -using System.Reflection; using System.Linq; +using System.Reflection; namespace Avalonia.Data.Core.Plugins { diff --git a/src/Avalonia.Base/Data/Core/Plugins/TaskStreamPlugin.cs b/src/Avalonia.Base/Data/Core/Plugins/TaskStreamPlugin.cs index cc9b3abd56..16862f576d 100644 --- a/src/Avalonia.Base/Data/Core/Plugins/TaskStreamPlugin.cs +++ b/src/Avalonia.Base/Data/Core/Plugins/TaskStreamPlugin.cs @@ -2,12 +2,10 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Reactive.Concurrency; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Reflection; using System.Threading.Tasks; -using Avalonia.Data; namespace Avalonia.Data.Core.Plugins { diff --git a/src/Avalonia.Base/Data/Core/SettableNode.cs b/src/Avalonia.Base/Data/Core/SettableNode.cs index e7c6ab766f..7c839acb78 100644 --- a/src/Avalonia.Base/Data/Core/SettableNode.cs +++ b/src/Avalonia.Base/Data/Core/SettableNode.cs @@ -1,9 +1,4 @@ -using Avalonia.Data; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System; namespace Avalonia.Data.Core { diff --git a/src/Avalonia.Base/Data/Core/StreamBindingExtensions.cs b/src/Avalonia.Base/Data/Core/StreamBindingExtensions.cs index fa8b56765c..fa2929c6ef 100644 --- a/src/Avalonia.Base/Data/Core/StreamBindingExtensions.cs +++ b/src/Avalonia.Base/Data/Core/StreamBindingExtensions.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using System.Threading.Tasks; namespace Avalonia diff --git a/src/Avalonia.Base/Data/IBinding.cs b/src/Avalonia.Base/Data/IBinding.cs index 70447ad3eb..95239cae06 100644 --- a/src/Avalonia.Base/Data/IBinding.cs +++ b/src/Avalonia.Base/Data/IBinding.cs @@ -17,7 +17,7 @@ namespace Avalonia.Data /// An optional anchor from which to locate required context. When binding to objects that /// are not in the logical tree, certain types of binding need an anchor into the tree in /// order to locate named controls or resources. The parameter - /// can be used to provice this context. + /// can be used to provide this context. /// /// Whether data validation should be enabled. /// diff --git a/src/Avalonia.Base/Logging/Logger.cs b/src/Avalonia.Base/Logging/Logger.cs index 2c60336816..b1132ff4a9 100644 --- a/src/Avalonia.Base/Logging/Logger.cs +++ b/src/Avalonia.Base/Logging/Logger.cs @@ -11,7 +11,7 @@ namespace Avalonia.Logging public static class Logger { /// - /// Gets or sets the application-defined sink that recieves the messages. + /// Gets or sets the application-defined sink that receives the messages. /// public static ILogSink Sink { get; set; } diff --git a/src/Avalonia.Base/Platform/IRuntimePlatform.cs b/src/Avalonia.Base/Platform/IRuntimePlatform.cs index 66253dc5b2..9adb98e689 100644 --- a/src/Avalonia.Base/Platform/IRuntimePlatform.cs +++ b/src/Avalonia.Base/Platform/IRuntimePlatform.cs @@ -1,9 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Platform { diff --git a/src/Avalonia.Base/PriorityLevel.cs b/src/Avalonia.Base/PriorityLevel.cs index b25247deaf..96661bd7ea 100644 --- a/src/Avalonia.Base/PriorityLevel.cs +++ b/src/Avalonia.Base/PriorityLevel.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Reactive.Disposables; using Avalonia.Data; -using Avalonia.Logging; namespace Avalonia { diff --git a/src/Avalonia.Base/PriorityValue.cs b/src/Avalonia.Base/PriorityValue.cs index 03094e2236..c8b434c6f9 100644 --- a/src/Avalonia.Base/PriorityValue.cs +++ b/src/Avalonia.Base/PriorityValue.cs @@ -12,12 +12,12 @@ using Avalonia.Utilities; namespace Avalonia { /// - /// Maintains a list of prioritised bindings together with a current value. + /// Maintains a list of prioritized bindings together with a current value. /// /// /// Bindings, in the form of s are added to the object using /// the method. With the observable is passed a priority, where lower values - /// represent higher priorites. The current is selected from the highest + /// represent higher priorities. The current is selected from the highest /// priority binding that doesn't return . Where there /// are multiple bindings registered with the same priority, the most recently added binding /// has a higher priority. Each time the value changes, the @@ -236,7 +236,7 @@ namespace Avalonia } /// - /// Updates the current and notifies all subscibers. + /// Updates the current and notifies all subscribers. /// /// The value to set. /// The priority level that the value came from. diff --git a/src/Avalonia.Base/PropertyMetadata.cs b/src/Avalonia.Base/PropertyMetadata.cs index 395aad53e4..bec562354d 100644 --- a/src/Avalonia.Base/PropertyMetadata.cs +++ b/src/Avalonia.Base/PropertyMetadata.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Data; namespace Avalonia diff --git a/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs b/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs index 6af5ab63cf..278efbcd0d 100644 --- a/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs +++ b/src/Avalonia.Base/Threading/AvaloniaSynchronizationContext.cs @@ -1,11 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Threading; namespace Avalonia.Threading @@ -48,4 +43,4 @@ namespace Avalonia.Threading Dispatcher.UIThread.InvokeAsync(() => d(state), DispatcherPriority.Send).Wait(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Base/Utilities/CharacterReader.cs b/src/Avalonia.Base/Utilities/CharacterReader.cs index 55be8db043..56f3f7abd4 100644 --- a/src/Avalonia.Base/Utilities/CharacterReader.cs +++ b/src/Avalonia.Base/Utilities/CharacterReader.cs @@ -2,8 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Globalization; -using System.Text; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/DeferredSetter.cs b/src/Avalonia.Base/Utilities/DeferredSetter.cs index ae6f599005..1b1324b1c5 100644 --- a/src/Avalonia.Base/Utilities/DeferredSetter.cs +++ b/src/Avalonia.Base/Utilities/DeferredSetter.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Reactive.Disposables; -using System.Runtime.CompilerServices; -using System.Text; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/IdentifierParser.cs b/src/Avalonia.Base/Utilities/IdentifierParser.cs index 0a2e8e1e1b..09c50bf147 100644 --- a/src/Avalonia.Base/Utilities/IdentifierParser.cs +++ b/src/Avalonia.Base/Utilities/IdentifierParser.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; using System.Globalization; -using System.Text; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/MathUtilities.cs b/src/Avalonia.Base/Utilities/MathUtilities.cs index 81eb05b957..ab21e5fda0 100644 --- a/src/Avalonia.Base/Utilities/MathUtilities.cs +++ b/src/Avalonia.Base/Utilities/MathUtilities.cs @@ -1,10 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/SingleOrDictionary.cs b/src/Avalonia.Base/Utilities/SingleOrDictionary.cs index fd984d758a..bda85f90e2 100644 --- a/src/Avalonia.Base/Utilities/SingleOrDictionary.cs +++ b/src/Avalonia.Base/Utilities/SingleOrDictionary.cs @@ -2,8 +2,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/SingleOrQueue.cs b/src/Avalonia.Base/Utilities/SingleOrQueue.cs index 4a66b72a56..643b0ba04d 100644 --- a/src/Avalonia.Base/Utilities/SingleOrQueue.cs +++ b/src/Avalonia.Base/Utilities/SingleOrQueue.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; namespace Avalonia.Utilities { diff --git a/src/Avalonia.Base/Utilities/TypeUtilities.cs b/src/Avalonia.Base/Utilities/TypeUtilities.cs index dd93811498..7b76457049 100644 --- a/src/Avalonia.Base/Utilities/TypeUtilities.cs +++ b/src/Avalonia.Base/Utilities/TypeUtilities.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection; @@ -103,8 +102,8 @@ namespace Avalonia.Utilities /// The type to cast to. /// The value to cast. /// The culture to use. - /// If sucessful, contains the cast value. - /// True if the cast was sucessful, otherwise false. + /// If successful, contains the cast value. + /// True if the cast was successful, otherwise false. public static bool TryConvert(Type to, object value, CultureInfo culture, out object result) { if (value == null) @@ -208,8 +207,8 @@ namespace Avalonia.Utilities /// /// The type to cast to. /// The value to cast. - /// If sucessful, contains the cast value. - /// True if the cast was sucessful, otherwise false. + /// If successful, contains the cast value. + /// True if the cast was successful, otherwise false. public static bool TryConvertImplicit(Type to, object value, out object result) { if (value == null) @@ -315,7 +314,7 @@ namespace Avalonia.Utilities /// Determines if a type is numeric. Nullable numeric types are considered numeric. /// /// - /// True if the type is numberic; otherwise false. + /// True if the type is numeric; otherwise false. /// /// /// Boolean is not considered numeric. diff --git a/src/Avalonia.Base/Utilities/WeakTimer.cs b/src/Avalonia.Base/Utilities/WeakTimer.cs index 5c44a6d122..a4d18ca13b 100644 --- a/src/Avalonia.Base/Utilities/WeakTimer.cs +++ b/src/Avalonia.Base/Utilities/WeakTimer.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Threading; namespace Avalonia.Utilities diff --git a/src/Avalonia.Base/ValueStore.cs b/src/Avalonia.Base/ValueStore.cs index ab80e74923..adbe89aceb 100644 --- a/src/Avalonia.Base/ValueStore.cs +++ b/src/Avalonia.Base/ValueStore.cs @@ -168,14 +168,14 @@ namespace Avalonia return value; } - private DeferredSetter _defferedSetter; + private DeferredSetter _deferredSetter; public DeferredSetter Setter { get { - return _defferedSetter ?? - (_defferedSetter = new DeferredSetter()); + return _deferredSetter ?? + (_deferredSetter = new DeferredSetter()); } } } diff --git a/src/Avalonia.Controls/AppBuilderBase.cs b/src/Avalonia.Controls/AppBuilderBase.cs index 83763c0836..c92d5d7694 100644 --- a/src/Avalonia.Controls/AppBuilderBase.cs +++ b/src/Avalonia.Controls/AppBuilderBase.cs @@ -57,14 +57,14 @@ namespace Avalonia.Controls public Action AfterSetupCallback { get; private set; } = builder => { }; /// - /// Gets or sets a method to call before Startis called on the . + /// Gets or sets a method to call before Start is called on the . /// public Action BeforeStartCallback { get; private set; } = builder => { }; - protected AppBuilderBase(IRuntimePlatform platform, Action platformSevices) + protected AppBuilderBase(IRuntimePlatform platform, Action platformServices) { RuntimePlatform = platform; - RuntimePlatformServicesInitializer = () => platformSevices((TAppBuilder)this); + RuntimePlatformServicesInitializer = () => platformServices((TAppBuilder)this); } /// diff --git a/src/Avalonia.Controls/Application.cs b/src/Avalonia.Controls/Application.cs index 499b65c5b7..4c549ac7d4 100644 --- a/src/Avalonia.Controls/Application.cs +++ b/src/Avalonia.Controls/Application.cs @@ -9,7 +9,6 @@ using Avalonia.Controls.Templates; using Avalonia.Input; using Avalonia.Input.Platform; using Avalonia.Input.Raw; -using Avalonia.Layout; using Avalonia.Platform; using Avalonia.Styling; using Avalonia.Threading; diff --git a/src/Avalonia.Controls/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox.cs index 96fb9be8ac..1bc402bc2f 100644 --- a/src/Avalonia.Controls/AutoCompleteBox.cs +++ b/src/Avalonia.Controls/AutoCompleteBox.cs @@ -352,8 +352,8 @@ namespace Avalonia.Controls private Func>> _asyncPopulator; private CancellationTokenSource _populationCancellationTokenSource; - private bool _itemTemplateIsFromValueMemeberBinding = true; - private bool _settingItemTemplateFromValueMemeberBinding; + private bool _itemTemplateIsFromValueMemberBinding = true; + private bool _settingItemTemplateFromValueMemberBinding; private object _selectedItem; private bool _isDropDownOpen; @@ -788,12 +788,12 @@ namespace Avalonia.Controls private void OnItemTemplatePropertyChanged(AvaloniaPropertyChangedEventArgs e) { - if (!_settingItemTemplateFromValueMemeberBinding) - _itemTemplateIsFromValueMemeberBinding = false; + if (!_settingItemTemplateFromValueMemberBinding) + _itemTemplateIsFromValueMemberBinding = false; } private void OnValueMemberBindingChanged(IBinding value) { - if(_itemTemplateIsFromValueMemeberBinding) + if(_itemTemplateIsFromValueMemberBinding) { var template = new FuncDataTemplate( @@ -805,9 +805,9 @@ namespace Avalonia.Controls return control; }); - _settingItemTemplateFromValueMemeberBinding = true; + _settingItemTemplateFromValueMemberBinding = true; ItemTemplate = template; - _settingItemTemplateFromValueMemeberBinding = false; + _settingItemTemplateFromValueMemberBinding = false; } } diff --git a/src/Avalonia.Controls/Border.cs b/src/Avalonia.Controls/Border.cs index 0382c8d675..5f84421c64 100644 --- a/src/Avalonia.Controls/Border.cs +++ b/src/Avalonia.Controls/Border.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia; using Avalonia.Controls.Utils; using Avalonia.Layout; using Avalonia.Media; @@ -115,4 +114,4 @@ namespace Avalonia.Controls return LayoutHelper.ArrangeChild(Child, finalSize, Padding, BorderThickness); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Calendar/Calendar.cs b/src/Avalonia.Controls/Calendar/Calendar.cs index 029e4dadc8..8f5a32634e 100644 --- a/src/Avalonia.Controls/Calendar/Calendar.cs +++ b/src/Avalonia.Controls/Calendar/Calendar.cs @@ -3,14 +3,14 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. +using System; +using System.Collections.ObjectModel; +using System.Diagnostics; using Avalonia.Controls.Primitives; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Media; -using System; -using System.Collections.ObjectModel; -using System.Diagnostics; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/Calendar/CalendarBlackoutDatesCollection.cs b/src/Avalonia.Controls/Calendar/CalendarBlackoutDatesCollection.cs index 0d48418683..5d883f2d14 100644 --- a/src/Avalonia.Controls/Calendar/CalendarBlackoutDatesCollection.cs +++ b/src/Avalonia.Controls/Calendar/CalendarBlackoutDatesCollection.cs @@ -3,11 +3,10 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. -using Avalonia.Threading; using System; using System.Collections.ObjectModel; using System.Linq; -using System.Threading; +using Avalonia.Threading; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/Calendar/CalendarDateRange.cs b/src/Avalonia.Controls/Calendar/CalendarDateRange.cs index 718cc7142b..47a0ad047b 100644 --- a/src/Avalonia.Controls/Calendar/CalendarDateRange.cs +++ b/src/Avalonia.Controls/Calendar/CalendarDateRange.cs @@ -4,7 +4,6 @@ // All other rights reserved. using System; -using System.Diagnostics; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/Calendar/CalendarDayButton.cs b/src/Avalonia.Controls/Calendar/CalendarDayButton.cs index f6d0fbba62..1b36f92fd3 100644 --- a/src/Avalonia.Controls/Calendar/CalendarDayButton.cs +++ b/src/Avalonia.Controls/Calendar/CalendarDayButton.cs @@ -3,11 +3,9 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. -using Avalonia.Input; using System; -using System.Collections.Generic; using System.Globalization; -using System.Text; +using Avalonia.Input; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/Calendar/CalendarExtensions.cs b/src/Avalonia.Controls/Calendar/CalendarExtensions.cs index 4fda02bff3..73de1c38f3 100644 --- a/src/Avalonia.Controls/Calendar/CalendarExtensions.cs +++ b/src/Avalonia.Controls/Calendar/CalendarExtensions.cs @@ -3,10 +3,7 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. -using System; -using System.Collections.Generic; using Avalonia.Input; -using System.Diagnostics; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/Calendar/CalendarItem.cs b/src/Avalonia.Controls/Calendar/CalendarItem.cs index b0cbd0be53..577555333f 100644 --- a/src/Avalonia.Controls/Calendar/CalendarItem.cs +++ b/src/Avalonia.Controls/Calendar/CalendarItem.cs @@ -3,13 +3,13 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. +using System; +using System.Diagnostics; +using System.Globalization; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.Media; -using System; -using System.Diagnostics; -using System.Globalization; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/Calendar/DatePicker.cs b/src/Avalonia.Controls/Calendar/DatePicker.cs index 08608ad359..2270598623 100644 --- a/src/Avalonia.Controls/Calendar/DatePicker.cs +++ b/src/Avalonia.Controls/Calendar/DatePicker.cs @@ -3,15 +3,14 @@ // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. -using Avalonia.Controls.Primitives; -using Avalonia.Data; -using Avalonia.Input; -using Avalonia.Interactivity; -using Avalonia.Media; using System; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; +using Avalonia.Controls.Primitives; +using Avalonia.Data; +using Avalonia.Input; +using Avalonia.Interactivity; namespace Avalonia.Controls { @@ -1083,7 +1082,7 @@ namespace Avalonia.Controls else { // If parse error: TextBox should have the latest valid - // selecteddate value: + // SelectedDate value: if (SelectedDate != null) { string newtext = this.DateTimeToString(SelectedDate.Value); diff --git a/src/Avalonia.Controls/ContextMenu.cs b/src/Avalonia.Controls/ContextMenu.cs index 0accb284b6..a69152c42b 100644 --- a/src/Avalonia.Controls/ContextMenu.cs +++ b/src/Avalonia.Controls/ContextMenu.cs @@ -34,7 +34,7 @@ namespace Avalonia.Controls /// /// Initializes a new instance of the class. /// - /// The menu iteraction handler. + /// The menu interaction handler. public ContextMenu(IMenuInteractionHandler interactionHandler) { Contract.Requires(interactionHandler != null); diff --git a/src/Avalonia.Controls/Control.cs b/src/Avalonia.Controls/Control.cs index 67288972b6..a00d586233 100644 --- a/src/Avalonia.Controls/Control.cs +++ b/src/Avalonia.Controls/Control.cs @@ -1,22 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Linq; -using System.Reactive; -using System.Reactive.Linq; -using System.Reactive.Subjects; -using Avalonia.Collections; using Avalonia.Controls.Primitives; using Avalonia.Controls.Templates; -using Avalonia.Data; -using Avalonia.Diagnostics; using Avalonia.Input; using Avalonia.Interactivity; -using Avalonia.Logging; -using Avalonia.LogicalTree; using Avalonia.Rendering; using Avalonia.Styling; using Avalonia.VisualTree; @@ -134,9 +122,9 @@ namespace Avalonia.Controls } /// - /// Gets the element that recieves the focus adorner. + /// Gets the element that receives the focus adorner. /// - /// The control that recieves the focus adorner. + /// The control that receives the focus adorner. protected virtual IControl GetTemplateFocusTarget() { return this; diff --git a/src/Avalonia.Controls/DataValidationErrors.cs b/src/Avalonia.Controls/DataValidationErrors.cs index a55bd63aa8..f0d7f8257e 100644 --- a/src/Avalonia.Controls/DataValidationErrors.cs +++ b/src/Avalonia.Controls/DataValidationErrors.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reactive.Linq; -using Avalonia.Controls.Primitives; using Avalonia.Controls.Templates; using Avalonia.Data; diff --git a/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs b/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs index c177d43917..224af979ab 100644 --- a/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs +++ b/src/Avalonia.Controls/Embedding/EmbeddableControlRoot.cs @@ -1,7 +1,6 @@ using System; using Avalonia.Controls.Platform; using Avalonia.Input; -using Avalonia.Layout; using Avalonia.Platform; using Avalonia.Styling; using JetBrains.Annotations; diff --git a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevel.cs b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevel.cs index 5becdc0f61..8b39cc03b8 100644 --- a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevel.cs +++ b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevel.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Layout; using Avalonia.Styling; namespace Avalonia.Controls.Embedding.Offscreen diff --git a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs index c986c5d07c..37bb72e75a 100644 --- a/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs +++ b/src/Avalonia.Controls/Embedding/Offscreen/OffscreenTopLevelImpl.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Platform; diff --git a/src/Avalonia.Controls/Expander.cs b/src/Avalonia.Controls/Expander.cs index 5323939b50..1049d742f3 100644 --- a/src/Avalonia.Controls/Expander.cs +++ b/src/Avalonia.Controls/Expander.cs @@ -1,6 +1,5 @@ using Avalonia.Animation; using Avalonia.Controls.Primitives; -using Avalonia.VisualTree; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/Generators/IItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/IItemContainerGenerator.cs index d139c95fd4..653a4f5dcb 100644 --- a/src/Avalonia.Controls/Generators/IItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/IItemContainerGenerator.cs @@ -28,7 +28,7 @@ namespace Avalonia.Controls.Generators Type ContainerType { get; } /// - /// Signalled whenever new containers are materialized. + /// Signaled whenever new containers are materialized. /// event EventHandler Materialized; @@ -110,4 +110,4 @@ namespace Avalonia.Controls.Generators /// The index of the container, or -1 if not found. int IndexFromContainer(IControl container); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Generators/ITreeItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/ITreeItemContainerGenerator.cs index 224fc9d17e..e2e591215e 100644 --- a/src/Avalonia.Controls/Generators/ITreeItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/ITreeItemContainerGenerator.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System.Collections.Generic; - namespace Avalonia.Controls.Generators { /// @@ -15,4 +13,4 @@ namespace Avalonia.Controls.Generators /// TreeContainerIndex Index { get; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Generators/ItemContainerGenerator`1.cs b/src/Avalonia.Controls/Generators/ItemContainerGenerator`1.cs index 259c524d59..320d6c8faf 100644 --- a/src/Avalonia.Controls/Generators/ItemContainerGenerator`1.cs +++ b/src/Avalonia.Controls/Generators/ItemContainerGenerator`1.cs @@ -2,8 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Linq.Expressions; -using System.Reflection; using Avalonia.Controls.Templates; using Avalonia.Data; diff --git a/src/Avalonia.Controls/Generators/MenuItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/MenuItemContainerGenerator.cs index c9b3a55aaa..d3cf70e0f8 100644 --- a/src/Avalonia.Controls/Generators/MenuItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/MenuItemContainerGenerator.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Avalonia.Controls.Generators +namespace Avalonia.Controls.Generators { public class MenuItemContainerGenerator : ItemContainerGenerator { diff --git a/src/Avalonia.Controls/Generators/TreeContainerIndex.cs b/src/Avalonia.Controls/Generators/TreeContainerIndex.cs index 08c11e2965..24b3fc1f32 100644 --- a/src/Avalonia.Controls/Generators/TreeContainerIndex.cs +++ b/src/Avalonia.Controls/Generators/TreeContainerIndex.cs @@ -22,7 +22,7 @@ namespace Avalonia.Controls.Generators private readonly Dictionary _containerToItem = new Dictionary(); /// - /// Signalled whenever new containers are materialized. + /// Signaled whenever new containers are materialized. /// public event EventHandler Materialized; diff --git a/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs b/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs index abcecb5b82..304c86dbf7 100644 --- a/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs +++ b/src/Avalonia.Controls/Generators/TreeItemContainerGenerator.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; using Avalonia.Controls.Templates; using Avalonia.Data; diff --git a/src/Avalonia.Controls/GridLength.cs b/src/Avalonia.Controls/GridLength.cs index 608879812c..f6a608cd71 100644 --- a/src/Avalonia.Controls/GridLength.cs +++ b/src/Avalonia.Controls/GridLength.cs @@ -1,11 +1,10 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using Avalonia.Utilities; using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; +using Avalonia.Utilities; namespace Avalonia.Controls { @@ -218,4 +217,4 @@ namespace Avalonia.Controls } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/GridSplitter.cs b/src/Avalonia.Controls/GridSplitter.cs index 8112b2babd..1e4c6f2c2a 100644 --- a/src/Avalonia.Controls/GridSplitter.cs +++ b/src/Avalonia.Controls/GridSplitter.cs @@ -116,27 +116,27 @@ namespace Avalonia.Controls _orientation = DetectOrientation(); - int defenitionIndex; //row or col + int definitionIndex; //row or col if (_orientation == Orientation.Vertical) { Cursor = new Cursor(StandardCursorType.SizeWestEast); _definitions = _grid.ColumnDefinitions.Cast().ToList(); - defenitionIndex = GetValue(Grid.ColumnProperty); + definitionIndex = GetValue(Grid.ColumnProperty); PseudoClasses.Add(":vertical"); } else { Cursor = new Cursor(StandardCursorType.SizeNorthSouth); - defenitionIndex = GetValue(Grid.RowProperty); + definitionIndex = GetValue(Grid.RowProperty); _definitions = _grid.RowDefinitions.Cast().ToList(); PseudoClasses.Add(":horizontal"); } - if (defenitionIndex > 0) - _prevDefinition = _definitions[defenitionIndex - 1]; + if (definitionIndex > 0) + _prevDefinition = _definitions[definitionIndex - 1]; - if (defenitionIndex < _definitions.Count - 1) - _nextDefinition = _definitions[defenitionIndex + 1]; + if (definitionIndex < _definitions.Count - 1) + _nextDefinition = _definitions[definitionIndex + 1]; } private Orientation DetectOrientation() @@ -167,4 +167,4 @@ namespace Avalonia.Controls return Orientation.Vertical; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/HotkeyManager.cs b/src/Avalonia.Controls/HotkeyManager.cs index a59fb86fb7..95752e7875 100644 --- a/src/Avalonia.Controls/HotkeyManager.cs +++ b/src/Avalonia.Controls/HotkeyManager.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Input; -using Avalonia.Controls; using Avalonia.Controls.Utils; using Avalonia.Input; diff --git a/src/Avalonia.Controls/IApplicationLifecycle.cs b/src/Avalonia.Controls/IApplicationLifecycle.cs index beb97a44ae..51f554c078 100644 --- a/src/Avalonia.Controls/IApplicationLifecycle.cs +++ b/src/Avalonia.Controls/IApplicationLifecycle.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/IControl.cs b/src/Avalonia.Controls/IControl.cs index e7f2903249..87b66d5f81 100644 --- a/src/Avalonia.Controls/IControl.cs +++ b/src/Avalonia.Controls/IControl.cs @@ -1,12 +1,9 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Controls.Templates; using Avalonia.Input; using Avalonia.Layout; -using Avalonia.LogicalTree; -using Avalonia.Styling; using Avalonia.VisualTree; namespace Avalonia.Controls @@ -23,4 +20,4 @@ namespace Avalonia.Controls { new IControl Parent { get; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/IMenu.cs b/src/Avalonia.Controls/IMenu.cs index e118ec043c..0722a22f08 100644 --- a/src/Avalonia.Controls/IMenu.cs +++ b/src/Avalonia.Controls/IMenu.cs @@ -1,5 +1,4 @@ -using System; -using Avalonia.Controls.Platform; +using Avalonia.Controls.Platform; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/IMenuElement.cs b/src/Avalonia.Controls/IMenuElement.cs index c9fc04dcc8..ee9d0fd6b6 100644 --- a/src/Avalonia.Controls/IMenuElement.cs +++ b/src/Avalonia.Controls/IMenuElement.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using Avalonia.Input; namespace Avalonia.Controls diff --git a/src/Avalonia.Controls/IMenuItem.cs b/src/Avalonia.Controls/IMenuItem.cs index 2657b1949f..132d565cb7 100644 --- a/src/Avalonia.Controls/IMenuItem.cs +++ b/src/Avalonia.Controls/IMenuItem.cs @@ -1,6 +1,4 @@ -using System; - -namespace Avalonia.Controls +namespace Avalonia.Controls { /// /// Represents a . diff --git a/src/Avalonia.Controls/IScrollable.cs b/src/Avalonia.Controls/IScrollable.cs index 9bbd0d8518..204e918d7b 100644 --- a/src/Avalonia.Controls/IScrollable.cs +++ b/src/Avalonia.Controls/IScrollable.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using Avalonia.VisualTree; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/IVirtualizingPanel.cs b/src/Avalonia.Controls/IVirtualizingPanel.cs index 2d8dcb42e3..cba196dfa8 100644 --- a/src/Avalonia.Controls/IVirtualizingPanel.cs +++ b/src/Avalonia.Controls/IVirtualizingPanel.cs @@ -14,7 +14,7 @@ namespace Avalonia.Controls /// Gets or sets the controller for the virtualizing panel. /// /// - /// A virtualizing controller is responsible for maintaing the controls in the virtualizing + /// A virtualizing controller is responsible for maintaining the controls in the virtualizing /// panel. This property will be set by the controller when virtualization is initialized. /// Note that this property may remain null if the panel is added to a control that does /// not act as a virtualizing controller. diff --git a/src/Avalonia.Controls/ItemsControl.cs b/src/Avalonia.Controls/ItemsControl.cs index 676e0af3de..9d4cbb9260 100644 --- a/src/Avalonia.Controls/ItemsControl.cs +++ b/src/Avalonia.Controls/ItemsControl.cs @@ -365,7 +365,7 @@ namespace Avalonia.Controls } /// - /// Caled when the property changes. + /// Called when the property changes. /// /// The event args. protected virtual void ItemsChanged(AvaloniaPropertyChangedEventArgs e) diff --git a/src/Avalonia.Controls/Menu.cs b/src/Avalonia.Controls/Menu.cs index edd7ed489e..00fca385a0 100644 --- a/src/Avalonia.Controls/Menu.cs +++ b/src/Avalonia.Controls/Menu.cs @@ -56,7 +56,7 @@ namespace Avalonia.Controls /// /// Initializes a new instance of the class. /// - /// The menu iteraction handler. + /// The menu interaction handler. public Menu(IMenuInteractionHandler interactionHandler) { Contract.Requires(interactionHandler != null); diff --git a/src/Avalonia.Controls/Mixins/ContentControlMixin.cs b/src/Avalonia.Controls/Mixins/ContentControlMixin.cs index 95193c0432..c4da00f5d0 100644 --- a/src/Avalonia.Controls/Mixins/ContentControlMixin.cs +++ b/src/Avalonia.Controls/Mixins/ContentControlMixin.cs @@ -3,13 +3,13 @@ using System; using System.Linq; +using System.Reactive.Disposables; using System.Runtime.CompilerServices; using Avalonia.Collections; using Avalonia.Controls.Presenters; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; using Avalonia.LogicalTree; -using Avalonia.Styling; namespace Avalonia.Controls.Mixins { @@ -75,6 +75,12 @@ namespace Avalonia.Controls.Mixins null, presenter.GetValue(ContentPresenter.ChildProperty)); + if (subscriptions.Value.TryGetValue(sender, out IDisposable previousSubscription)) + { + subscription = new CompositeDisposable(previousSubscription, subscription); + subscriptions.Value.Remove(sender); + } + subscriptions.Value.Add(sender, subscription); } } diff --git a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs index 59d2949b81..de68eb0ab0 100644 --- a/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs +++ b/src/Avalonia.Controls/NumericUpDown/NumericUpDown.cs @@ -526,7 +526,7 @@ namespace Avalonia.Controls return result; } - // Since the conversion from Value to text using a FormartString may not be parsable, + // Since the conversion from Value to text using a FormatString may not be parsable, // we verify that the already existing text is not the exact same value. var currentValueText = ConvertValueToText(); if (Equals(currentValueText, text)) @@ -571,7 +571,7 @@ namespace Avalonia.Controls } /// - /// Called by OnSpin when the spin direction is SpinDirection.Descrease. + /// Called by OnSpin when the spin direction is SpinDirection.Decrease. /// private void OnDecrement() { @@ -890,7 +890,7 @@ namespace Avalonia.Controls if (_isTextChangedFromUI && !parsedTextIsValid) { // Text input was made from the user and the text - // repesents an invalid value. Disable the spinner in this case. + // represents an invalid value. Disable the spinner in this case. if (Spinner != null) { Spinner.ValidSpinDirection = ValidSpinDirections.None; @@ -995,4 +995,4 @@ namespace Avalonia.Controls return false; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs b/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs index 420c56111f..e958b7aa15 100644 --- a/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs +++ b/src/Avalonia.Controls/Platform/ExportWindowingSubsystemAttribute.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Platform { diff --git a/src/Avalonia.Controls/Platform/IMenuInteractionHandler.cs b/src/Avalonia.Controls/Platform/IMenuInteractionHandler.cs index 342d3dd1c9..dd8503f768 100644 --- a/src/Avalonia.Controls/Platform/IMenuInteractionHandler.cs +++ b/src/Avalonia.Controls/Platform/IMenuInteractionHandler.cs @@ -1,7 +1,4 @@ -using System; -using Avalonia.Input; - -namespace Avalonia.Controls.Platform +namespace Avalonia.Controls.Platform { /// /// Handles user interaction for menus. diff --git a/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs b/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs index a84a58906e..ecbc6d2234 100644 --- a/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs +++ b/src/Avalonia.Controls/Platform/IPlatformIconLoader.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Media.Imaging; +using System.IO; namespace Avalonia.Platform { diff --git a/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs index 9ba68f584e..e788b3c73e 100644 --- a/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs +++ b/src/Avalonia.Controls/Platform/IWindowBaseImpl.cs @@ -6,7 +6,7 @@ namespace Avalonia.Platform public interface IWindowBaseImpl : ITopLevelImpl { /// - /// Shows the toplevel. + /// Shows the top level. /// void Show(); @@ -62,7 +62,7 @@ namespace Avalonia.Platform Size MaxClientSize { get; } /// - /// Sets the client size of the toplevel. + /// Sets the client size of the top level. /// void Resize(Size clientSize); @@ -82,4 +82,4 @@ namespace Avalonia.Platform /// IScreenImpl Screen { get; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Platform/IWindowingPlatform.cs b/src/Avalonia.Controls/Platform/IWindowingPlatform.cs index 5dcd0a39e8..5c2c1a8da3 100644 --- a/src/Avalonia.Controls/Platform/IWindowingPlatform.cs +++ b/src/Avalonia.Controls/Platform/IWindowingPlatform.cs @@ -1,9 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - namespace Avalonia.Platform { public interface IWindowingPlatform diff --git a/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs b/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs index 4dc96a074d..62cd012d51 100644 --- a/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs +++ b/src/Avalonia.Controls/Platform/Surfaces/IFramebufferPlatformSurface.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Avalonia.Platform; +using Avalonia.Platform; namespace Avalonia.Controls.Platform.Surfaces { diff --git a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs index 1d5a187a73..ba2c7c91d8 100644 --- a/src/Avalonia.Controls/Presenters/CarouselPresenter.cs +++ b/src/Avalonia.Controls/Presenters/CarouselPresenter.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Reactive.Linq; using System.Threading.Tasks; using Avalonia.Animation; -using Avalonia.Controls.Generators; using Avalonia.Controls.Primitives; using Avalonia.Controls.Utils; using Avalonia.Data; @@ -251,4 +250,4 @@ namespace Avalonia.Controls.Presenters } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Presenters/IPresenter.cs b/src/Avalonia.Controls/Presenters/IPresenter.cs index e06be4e82b..f78ba4c19d 100644 --- a/src/Avalonia.Controls/Presenters/IPresenter.cs +++ b/src/Avalonia.Controls/Presenters/IPresenter.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using Avalonia.Controls.Primitives; -using Avalonia.Styling; namespace Avalonia.Controls.Presenters { diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs index e293cff211..c5344b29d9 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizer.cs @@ -8,7 +8,6 @@ using System.Reactive.Linq; using Avalonia.Controls.Primitives; using Avalonia.Controls.Utils; using Avalonia.Input; -using Avalonia.VisualTree; namespace Avalonia.Controls.Presenters { diff --git a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs index b98f26b87f..f31a48b2a0 100644 --- a/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs +++ b/src/Avalonia.Controls/Presenters/ItemVirtualizerSimple.cs @@ -390,7 +390,7 @@ namespace Avalonia.Controls.Presenters /// The delta of the move. /// /// If the move is less than a page, then this method moves the containers for the items - /// that are still visible to the correct place, and recyles and moves the others. For + /// that are still visible to the correct place, and recycles and moves the others. For /// example: if there are 20 items and 10 containers visible and the user scrolls 5 /// items down, then the bottom 5 containers will be moved to the top and the top 5 will /// be moved to the bottom and recycled to display the newly visible item. Updates diff --git a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs index 8d0c6f16cb..2ef7941b55 100644 --- a/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs +++ b/src/Avalonia.Controls/Presenters/ScrollContentPresenter.cs @@ -7,7 +7,6 @@ using System.Reactive.Disposables; using System.Reactive.Linq; using Avalonia.Controls.Primitives; using Avalonia.Input; -using Avalonia.Layout; using Avalonia.VisualTree; namespace Avalonia.Controls.Presenters @@ -319,4 +318,4 @@ namespace Avalonia.Controls.Presenters } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Presenters/TextPresenter.cs b/src/Avalonia.Controls/Presenters/TextPresenter.cs index a4dc35f736..a30d9bfc48 100644 --- a/src/Avalonia.Controls/Presenters/TextPresenter.cs +++ b/src/Avalonia.Controls/Presenters/TextPresenter.cs @@ -4,7 +4,6 @@ using System; using System.Reactive.Linq; using Avalonia.Media; -using Avalonia.Styling; using Avalonia.Threading; using Avalonia.VisualTree; diff --git a/src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs b/src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs index 82ab929d53..c5aa73e56a 100644 --- a/src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/HeaderedItemsControl.cs @@ -1,8 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Linq; using Avalonia.Controls.Mixins; using Avalonia.Controls.Presenters; diff --git a/src/Avalonia.Controls/Primitives/Popup.cs b/src/Avalonia.Controls/Primitives/Popup.cs index 005717d681..5e79711f5a 100644 --- a/src/Avalonia.Controls/Primitives/Popup.cs +++ b/src/Avalonia.Controls/Primitives/Popup.cs @@ -6,11 +6,10 @@ using System.Linq; using Avalonia.Input; using Avalonia.Input.Raw; using Avalonia.Interactivity; +using Avalonia.Layout; using Avalonia.LogicalTree; using Avalonia.Metadata; -using Avalonia.Rendering; using Avalonia.VisualTree; -using Avalonia.Layout; namespace Avalonia.Controls.Primitives { @@ -473,4 +472,4 @@ namespace Avalonia.Controls.Primitives } } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Primitives/PopupRoot.cs b/src/Avalonia.Controls/Primitives/PopupRoot.cs index 0ae4be5550..fdec9febd3 100644 --- a/src/Avalonia.Controls/Primitives/PopupRoot.cs +++ b/src/Avalonia.Controls/Primitives/PopupRoot.cs @@ -2,12 +2,9 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Linq; using Avalonia.Controls.Platform; using Avalonia.Controls.Presenters; using Avalonia.Interactivity; -using Avalonia.Layout; -using Avalonia.LogicalTree; using Avalonia.Media; using Avalonia.Platform; using Avalonia.Styling; diff --git a/src/Avalonia.Controls/Primitives/RangeBase.cs b/src/Avalonia.Controls/Primitives/RangeBase.cs index b46562e99e..76df94cdb8 100644 --- a/src/Avalonia.Controls/Primitives/RangeBase.cs +++ b/src/Avalonia.Controls/Primitives/RangeBase.cs @@ -130,7 +130,7 @@ namespace Avalonia.Controls.Primitives } /// - /// Throws an exception if the double valus is NaN or Inf. + /// Throws an exception if the double value is NaN or Inf. /// /// The value. /// The name of the property being set. diff --git a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs index 5451cf0701..bb39b005cc 100644 --- a/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs +++ b/src/Avalonia.Controls/Primitives/SelectingItemsControl.cs @@ -11,7 +11,6 @@ using Avalonia.Controls.Generators; using Avalonia.Data; using Avalonia.Input; using Avalonia.Interactivity; -using Avalonia.Metadata; using Avalonia.Styling; using Avalonia.VisualTree; diff --git a/src/Avalonia.Controls/Primitives/Thumb.cs b/src/Avalonia.Controls/Primitives/Thumb.cs index b0f9ab1f85..b01ddd5dba 100644 --- a/src/Avalonia.Controls/Primitives/Thumb.cs +++ b/src/Avalonia.Controls/Primitives/Thumb.cs @@ -4,7 +4,6 @@ using System; using Avalonia.Input; using Avalonia.Interactivity; -using Avalonia.Layout; namespace Avalonia.Controls.Primitives { diff --git a/src/Avalonia.Controls/ProgressBar.cs b/src/Avalonia.Controls/ProgressBar.cs index b7db352c74..085db75ce1 100644 --- a/src/Avalonia.Controls/ProgressBar.cs +++ b/src/Avalonia.Controls/ProgressBar.cs @@ -1,12 +1,8 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Reactive.Linq; -using Avalonia.Animation; using Avalonia.Controls.Primitives; -using Avalonia.Layout; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/Remote/RemoteServer.cs b/src/Avalonia.Controls/Remote/RemoteServer.cs index 9c0f3464a5..e116316904 100644 --- a/src/Avalonia.Controls/Remote/RemoteServer.cs +++ b/src/Avalonia.Controls/Remote/RemoteServer.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Embedding; using Avalonia.Controls.Remote.Server; using Avalonia.Platform; diff --git a/src/Avalonia.Controls/Remote/RemoteWidget.cs b/src/Avalonia.Controls/Remote/RemoteWidget.cs index ea8c3ebe52..2d4f2e6b52 100644 --- a/src/Avalonia.Controls/Remote/RemoteWidget.cs +++ b/src/Avalonia.Controls/Remote/RemoteWidget.cs @@ -1,6 +1,5 @@ using System; using System.Runtime.InteropServices; -using Avalonia.Input; using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Remote.Protocol; @@ -76,4 +75,4 @@ namespace Avalonia.Controls.Remote base.Render(context); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs b/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs index cf4cec9268..b302f2f5ec 100644 --- a/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs +++ b/src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs @@ -1,9 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Embedding.Offscreen; using Avalonia.Controls.Platform.Surfaces; using Avalonia.Input; @@ -94,10 +91,10 @@ namespace Avalonia.Controls.Remote.Server RenderIfNeeded(); } - protected virtual Size Measure(Size constaint) + protected virtual Size Measure(Size constraint) { var l = (ILayoutable) InputRoot; - l.Measure(constaint); + l.Measure(constraint); return l.DesiredSize; } diff --git a/src/Avalonia.Controls/Separator.cs b/src/Avalonia.Controls/Separator.cs index 2028a5cfbb..84b2a33d7b 100644 --- a/src/Avalonia.Controls/Separator.cs +++ b/src/Avalonia.Controls/Separator.cs @@ -1,11 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Primitives; namespace Avalonia.Controls diff --git a/src/Avalonia.Controls/Shapes/Path.cs b/src/Avalonia.Controls/Shapes/Path.cs index 08bed79b3a..e0952d3e9b 100644 --- a/src/Avalonia.Controls/Shapes/Path.cs +++ b/src/Avalonia.Controls/Shapes/Path.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using Avalonia.Media; namespace Avalonia.Controls.Shapes diff --git a/src/Avalonia.Controls/Shapes/Shape.cs b/src/Avalonia.Controls/Shapes/Shape.cs index a1848a95b1..604051ef28 100644 --- a/src/Avalonia.Controls/Shapes/Shape.cs +++ b/src/Avalonia.Controls/Shapes/Shape.cs @@ -4,7 +4,6 @@ using System; using System.Reflection; using Avalonia.Collections; -using Avalonia.Controls; using Avalonia.Media; namespace Avalonia.Controls.Shapes diff --git a/src/Avalonia.Controls/Spinner.cs b/src/Avalonia.Controls/Spinner.cs index e00ff3823c..5ee13f45c4 100644 --- a/src/Avalonia.Controls/Spinner.cs +++ b/src/Avalonia.Controls/Spinner.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Avalonia.Interactivity; namespace Avalonia.Controls @@ -54,7 +52,7 @@ namespace Avalonia.Controls public SpinDirection Direction { get; } /// - /// Get or set whheter the spin event originated from a mouse wheel event. + /// Get or set whether the spin event originated from a mouse wheel event. /// public bool UsingMouseWheel{ get; } diff --git a/src/Avalonia.Controls/Templates/FuncDataTemplate`1.cs b/src/Avalonia.Controls/Templates/FuncDataTemplate`1.cs index 7154c0e558..9339aa6924 100644 --- a/src/Avalonia.Controls/Templates/FuncDataTemplate`1.cs +++ b/src/Avalonia.Controls/Templates/FuncDataTemplate`1.cs @@ -42,7 +42,7 @@ namespace Avalonia.Controls.Templates } /// - /// Casts a stongly typed match function to a weakly typed one. + /// Casts a strongly typed match function to a weakly typed one. /// /// The strongly typed function. /// The weakly typed function. @@ -52,7 +52,7 @@ namespace Avalonia.Controls.Templates } /// - /// Casts a stongly typed build function to a weakly typed one. + /// Casts a strongly typed build function to a weakly typed one. /// /// The strong data type. /// The strongly typed function. @@ -62,4 +62,4 @@ namespace Avalonia.Controls.Templates return o => f((T)o); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Templates/FuncMemberSelector.cs b/src/Avalonia.Controls/Templates/FuncMemberSelector.cs index b8f2c2e311..5ab186261e 100644 --- a/src/Avalonia.Controls/Templates/FuncMemberSelector.cs +++ b/src/Avalonia.Controls/Templates/FuncMemberSelector.cs @@ -25,11 +25,11 @@ namespace Avalonia.Controls.Templates /// /// Selects a member of an object. /// - /// The obeject. + /// The object. /// The selected member. public object Select(object o) { return (o is TObject) ? _selector((TObject)o) : default(TMember); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate.cs b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate.cs index 2e55dd3552..e7c9cf8608 100644 --- a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate.cs +++ b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate.cs @@ -9,7 +9,7 @@ using Avalonia.Data; namespace Avalonia.Controls.Templates { /// - /// A template used to build hierachical data. + /// A template used to build hierarchical data. /// public class FuncTreeDataTemplate : FuncDataTemplate, ITreeDataTemplate { diff --git a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs index d7d6a87769..4ca96f60bd 100644 --- a/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs +++ b/src/Avalonia.Controls/Templates/FuncTreeDataTemplate`1.cs @@ -7,7 +7,7 @@ using System.Collections; namespace Avalonia.Controls.Templates { /// - /// A template used to build hierachical data. + /// A template used to build hierarchical data. /// /// The type of the template's data. public class FuncTreeDataTemplate : FuncTreeDataTemplate diff --git a/src/Avalonia.Controls/Templates/IDataTemplateHost.cs b/src/Avalonia.Controls/Templates/IDataTemplateHost.cs index 5cc12581d4..267938b3bd 100644 --- a/src/Avalonia.Controls/Templates/IDataTemplateHost.cs +++ b/src/Avalonia.Controls/Templates/IDataTemplateHost.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; namespace Avalonia.Controls.Templates { diff --git a/src/Avalonia.Controls/Templates/IMemberSelector.cs b/src/Avalonia.Controls/Templates/IMemberSelector.cs index b7172fa492..e1ec42a849 100644 --- a/src/Avalonia.Controls/Templates/IMemberSelector.cs +++ b/src/Avalonia.Controls/Templates/IMemberSelector.cs @@ -11,8 +11,8 @@ namespace Avalonia.Controls.Templates /// /// Selects a member of an object. /// - /// The obeject. + /// The object. /// The selected member. object Select(object o); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Templates/ITreeDataTemplate.cs b/src/Avalonia.Controls/Templates/ITreeDataTemplate.cs index 580839be97..9ed8987681 100644 --- a/src/Avalonia.Controls/Templates/ITreeDataTemplate.cs +++ b/src/Avalonia.Controls/Templates/ITreeDataTemplate.cs @@ -6,7 +6,7 @@ using Avalonia.Data; namespace Avalonia.Controls.Templates { /// - /// Interface representing a template used to build hierachical data. + /// Interface representing a template used to build hierarchical data. /// public interface ITreeDataTemplate : IDataTemplate { @@ -20,4 +20,4 @@ namespace Avalonia.Controls.Templates /// InstancedBinding ItemsSelector(object item); } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/TextBlock.cs b/src/Avalonia.Controls/TextBlock.cs index fd46efa76f..e91d2e8fa7 100644 --- a/src/Avalonia.Controls/TextBlock.cs +++ b/src/Avalonia.Controls/TextBlock.cs @@ -21,7 +21,7 @@ namespace Avalonia.Controls public static readonly StyledProperty BackgroundProperty = Border.BackgroundProperty.AddOwner(); - // TODO: Define these attached properties elswhere (e.g. on a Text class) and AddOwner + // TODO: Define these attached properties elsewhere (e.g. on a Text class) and AddOwner // them into TextBlock. /// @@ -406,4 +406,4 @@ namespace Avalonia.Controls InvalidateMeasure(); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/ToolTip.cs b/src/Avalonia.Controls/ToolTip.cs index 10e964d014..28d1ba5e0f 100644 --- a/src/Avalonia.Controls/ToolTip.cs +++ b/src/Avalonia.Controls/ToolTip.cs @@ -55,7 +55,7 @@ namespace Avalonia.Controls AvaloniaProperty.RegisterAttached("ShowDelay", 400); /// - /// Stores the curernt instance in the control. + /// Stores the current instance in the control. /// private static readonly AttachedProperty ToolTipProperty = AvaloniaProperty.RegisterAttached("ToolTip"); diff --git a/src/Avalonia.Controls/ToolTipService.cs b/src/Avalonia.Controls/ToolTipService.cs index bfd7ef0f33..384a9db0cf 100644 --- a/src/Avalonia.Controls/ToolTipService.cs +++ b/src/Avalonia.Controls/ToolTipService.cs @@ -5,7 +5,7 @@ using Avalonia.Threading; namespace Avalonia.Controls { /// - /// Handeles interaction with controls. + /// Handles interaction with controls. /// internal sealed class ToolTipService { @@ -95,4 +95,4 @@ namespace Avalonia.Controls _timer = null; } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/TopLevel.cs b/src/Avalonia.Controls/TopLevel.cs index 9fdc097c3f..1161ded25f 100644 --- a/src/Avalonia.Controls/TopLevel.cs +++ b/src/Avalonia.Controls/TopLevel.cs @@ -2,9 +2,7 @@ // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; -using System.Reactive.Disposables; using System.Reactive.Linq; -using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Input.Raw; @@ -225,7 +223,7 @@ namespace Avalonia.Controls protected virtual IRenderTarget CreateRenderTarget() { if(PlatformImpl == null) - throw new InvalidOperationException("Cann't create render target, PlatformImpl is null (might be already disposed)"); + throw new InvalidOperationException("Can't create render target, PlatformImpl is null (might be already disposed)"); return _renderInterface.CreateRenderTarget(PlatformImpl.Surfaces); } diff --git a/src/Avalonia.Controls/TreeView.cs b/src/Avalonia.Controls/TreeView.cs index 4575fa767b..3003dab85e 100644 --- a/src/Avalonia.Controls/TreeView.cs +++ b/src/Avalonia.Controls/TreeView.cs @@ -1,7 +1,6 @@ // Copyright (c) The Avalonia Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. -using System; using System.Linq; using Avalonia.Controls.Generators; using Avalonia.Controls.Primitives; @@ -14,7 +13,7 @@ using Avalonia.VisualTree; namespace Avalonia.Controls { /// - /// Displays a hierachical tree of data. + /// Displays a hierarchical tree of data. /// public class TreeView : ItemsControl, ICustomKeyboardNavigation { diff --git a/src/Avalonia.Controls/Utils/AncestorFinder.cs b/src/Avalonia.Controls/Utils/AncestorFinder.cs index 6ee284e05d..d02202ca02 100644 --- a/src/Avalonia.Controls/Utils/AncestorFinder.cs +++ b/src/Avalonia.Controls/Utils/AncestorFinder.cs @@ -1,13 +1,10 @@ -using System; -using System.Collections.Generic; +using System; using System.Linq; using System.Reactive; using System.Reactive.Disposables; using System.Reactive.Linq; using System.Reactive.Subjects; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace Avalonia.Controls.Utils { diff --git a/src/Avalonia.Controls/Utils/GridLayout.cs b/src/Avalonia.Controls/Utils/GridLayout.cs index 10a94a8c82..363428b289 100644 --- a/src/Avalonia.Controls/Utils/GridLayout.cs +++ b/src/Avalonia.Controls/Utils/GridLayout.cs @@ -376,7 +376,7 @@ namespace Avalonia.Controls.Utils // 1. Determine all one-span column's desired widths or row's desired heights. // 2. Order the multi-span conventions by its last index // (Notice that the sorted data is much smaller than the source.) - // 3. Determine each multi-span last index by calculating the maximun desired size. + // 3. Determine each multi-span last index by calculating the maximum desired size. // Before we determine the behavior of this method, we just aggregate the one-span * columns. diff --git a/src/Avalonia.Controls/Utils/IEnumerableUtils.cs b/src/Avalonia.Controls/Utils/IEnumerableUtils.cs index 361857aeb7..40ebd406c3 100644 --- a/src/Avalonia.Controls/Utils/IEnumerableUtils.cs +++ b/src/Avalonia.Controls/Utils/IEnumerableUtils.cs @@ -3,7 +3,6 @@ using System; using System.Collections; -using System.Globalization; using System.Linq; namespace Avalonia.Controls.Utils diff --git a/src/Avalonia.Controls/Utils/SelectingItemsControlSelectionAdapter.cs b/src/Avalonia.Controls/Utils/SelectingItemsControlSelectionAdapter.cs index 43c8a5aa6c..4d814170c6 100644 --- a/src/Avalonia.Controls/Utils/SelectingItemsControlSelectionAdapter.cs +++ b/src/Avalonia.Controls/Utils/SelectingItemsControlSelectionAdapter.cs @@ -4,15 +4,12 @@ // All other rights reserved. using System; +using System.Collections; using System.Linq; -using System.Collections.Generic; -using System.Text; using Avalonia.Controls.Primitives; -using Avalonia.Interactivity; using Avalonia.Input; +using Avalonia.Interactivity; using Avalonia.LogicalTree; -using System.Collections; -using System.Diagnostics; namespace Avalonia.Controls.Utils { diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs index bd07cf6740..39b4f05545 100644 --- a/src/Avalonia.Controls/Window.cs +++ b/src/Avalonia.Controls/Window.cs @@ -86,7 +86,7 @@ namespace Avalonia.Controls AvaloniaProperty.Register(nameof(Icon)); /// - /// Defines the proeprty. + /// Defines the property. /// public static readonly DirectProperty WindowStartupLocationProperty = AvaloniaProperty.RegisterDirect( @@ -100,7 +100,7 @@ namespace Avalonia.Controls private readonly NameScope _nameScope = new NameScope(); private object _dialogResult; private readonly Size _maxPlatformClientSize; - private WindowStartupLocation _windowStartupLoction; + private WindowStartupLocation _windowStartupLocation; /// /// Initializes static members of the class. @@ -237,8 +237,8 @@ namespace Avalonia.Controls /// public WindowStartupLocation WindowStartupLocation { - get { return _windowStartupLoction; } - set { SetAndRaise(WindowStartupLocationProperty, ref _windowStartupLoction, value); } + get { return _windowStartupLocation; } + set { SetAndRaise(WindowStartupLocationProperty, ref _windowStartupLocation, value); } } /// @@ -409,7 +409,7 @@ namespace Avalonia.Controls /// The type of the result produced by the dialog. /// /// . - /// A task that can be used to retrive the result of the dialog when it closes. + /// A task that can be used to retrieve the result of the dialog when it closes. /// public Task ShowDialog() { diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs index c0b664ebc3..f609432545 100644 --- a/src/Avalonia.Controls/WindowBase.cs +++ b/src/Avalonia.Controls/WindowBase.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Reactive.Disposables; using System.Reactive.Linq; -using System.Text; -using System.Threading.Tasks; using Avalonia.Controls.Primitives; using Avalonia.Input; using Avalonia.Layout; diff --git a/src/Avalonia.Controls/WindowIcon.cs b/src/Avalonia.Controls/WindowIcon.cs index 26195e6d76..9e4329372a 100644 --- a/src/Avalonia.Controls/WindowIcon.cs +++ b/src/Avalonia.Controls/WindowIcon.cs @@ -1,11 +1,6 @@ -using Avalonia.Platform; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.IO; using Avalonia.Media.Imaging; +using Avalonia.Platform; namespace Avalonia.Controls { diff --git a/src/Avalonia.Controls/WrapPanel.cs b/src/Avalonia.Controls/WrapPanel.cs index 84d3cc791e..8ee0636124 100644 --- a/src/Avalonia.Controls/WrapPanel.cs +++ b/src/Avalonia.Controls/WrapPanel.cs @@ -132,7 +132,7 @@ namespace Avalonia.Controls double accumulatedV = 0; var uvFinalSize = CreateUVSize(finalSize); var lineSize = CreateUVSize(); - int firstChildInLineindex = 0; + int firstChildInLineIndex = 0; for (int index = 0; index < Children.Count; index++) { var child = Children[index]; @@ -144,32 +144,32 @@ namespace Avalonia.Controls } else // moving to next line { - var controlsInLine = GetContolsBetween(firstChildInLineindex, index); + var controlsInLine = GetControlsBetween(firstChildInLineIndex, index); ArrangeLine(accumulatedV, lineSize.V, controlsInLine); accumulatedV += lineSize.V; lineSize = childSize; - firstChildInLineindex = index; + firstChildInLineIndex = index; } } - if (firstChildInLineindex < Children.Count) + if (firstChildInLineIndex < Children.Count) { - var controlsInLine = GetContolsBetween(firstChildInLineindex, Children.Count); + var controlsInLine = GetControlsBetween(firstChildInLineIndex, Children.Count); ArrangeLine(accumulatedV, lineSize.V, controlsInLine); } return finalSize; } - private IEnumerable GetContolsBetween(int first, int last) + private IEnumerable GetControlsBetween(int first, int last) { return Children.Skip(first).Take(last - first); } - private void ArrangeLine(double v, double lineV, IEnumerable contols) + private void ArrangeLine(double v, double lineV, IEnumerable controls) { double u = 0; bool isHorizontal = (Orientation == Orientation.Horizontal); - foreach (var child in contols) + foreach (var child in controls) { var childSize = CreateUVSize(child.DesiredSize); var x = isHorizontal ? u : v; @@ -181,9 +181,9 @@ namespace Avalonia.Controls } } /// - /// Used to not not write sepearate code for horizontal and vertical orientation. + /// Used to not not write separate code for horizontal and vertical orientation. /// U is direction in line. (x if orientation is horizontal) - /// V is direction of lines. (y if orientation is horizonral) + /// V is direction of lines. (y if orientation is horizontal) /// [DebuggerDisplay("U = {U} V = {V}")] private struct UVSize diff --git a/src/Avalonia.Interactivity/RoutedEvent.cs b/src/Avalonia.Interactivity/RoutedEvent.cs index 61bb567d54..2d752133c1 100644 --- a/src/Avalonia.Interactivity/RoutedEvent.cs +++ b/src/Avalonia.Interactivity/RoutedEvent.cs @@ -72,7 +72,9 @@ namespace Avalonia.Interactivity { Contract.Requires(name != null); - return new RoutedEvent(name, routingStrategy, typeof(TOwner)); + var routedEvent = new RoutedEvent(name, routingStrategy, typeof(TOwner)); + RoutedEventRegistry.Instance.Register(typeof(TOwner), routedEvent); + return routedEvent; } public static RoutedEvent Register( @@ -83,7 +85,9 @@ namespace Avalonia.Interactivity { Contract.Requires(name != null); - return new RoutedEvent(name, routingStrategy, ownerType); + var routedEvent = new RoutedEvent(name, routingStrategy, ownerType); + RoutedEventRegistry.Instance.Register(ownerType, routedEvent); + return routedEvent; } public IDisposable AddClassHandler( diff --git a/src/Avalonia.Interactivity/RoutedEventRegistry.cs b/src/Avalonia.Interactivity/RoutedEventRegistry.cs new file mode 100644 index 0000000000..34c970a806 --- /dev/null +++ b/src/Avalonia.Interactivity/RoutedEventRegistry.cs @@ -0,0 +1,90 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System; +using System.Collections.Generic; + +namespace Avalonia.Interactivity +{ + /// + /// Tracks registered s. + /// + public class RoutedEventRegistry + { + private readonly Dictionary> _registeredRoutedEvents = + new Dictionary>(); + + /// + /// Gets the instance. + /// + public static RoutedEventRegistry Instance { get; } + = new RoutedEventRegistry(); + + /// + /// Registers a on a type. + /// + /// The type. + /// The event. + /// + /// You won't usually want to call this method directly, instead use the + /// + /// method. + /// + public void Register(Type type, RoutedEvent @event) + { + Contract.Requires(type != null); + Contract.Requires(@event != null); + + if (!_registeredRoutedEvents.TryGetValue(type, out var list)) + { + list = new List(); + _registeredRoutedEvents.Add(type, list); + } + list.Add(@event); + } + + /// + /// Returns all routed events, that are currently registered in the event registry. + /// + /// All routed events, that are currently registered in the event registry. + public IEnumerable GetAllRegistered() + { + foreach (var events in _registeredRoutedEvents.Values) + { + foreach (var e in events) + { + yield return e; + } + } + } + + /// + /// Returns all routed events registered with the provided type. + /// If the type is not found or does not provide any routed events, an empty list is returned. + /// + /// The type. + /// All routed events registered with the provided type. + public IReadOnlyList GetRegistered(Type type) + { + Contract.Requires(type != null); + + if (_registeredRoutedEvents.TryGetValue(type, out var events)) + { + return events; + } + + return Array.Empty(); + } + + /// + /// Returns all routed events registered with the provided type. + /// If the type is not found or does not provide any routed events, an empty list is returned. + /// + /// The type. + /// All routed events registered with the provided type. + public IReadOnlyList GetRegistered() + { + return GetRegistered(typeof(TOwner)); + } + } +} diff --git a/tests/Avalonia.Controls.UnitTests/Mixins/ContentControlMixinTests.cs b/tests/Avalonia.Controls.UnitTests/Mixins/ContentControlMixinTests.cs new file mode 100644 index 0000000000..f06553411c --- /dev/null +++ b/tests/Avalonia.Controls.UnitTests/Mixins/ContentControlMixinTests.cs @@ -0,0 +1,106 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using System.Linq; +using Avalonia.Collections; +using Avalonia.Controls.Mixins; +using Avalonia.Controls.Presenters; +using Avalonia.Controls.Primitives; +using Avalonia.Controls.Templates; +using Avalonia.LogicalTree; +using Moq; +using Xunit; + +namespace Avalonia.Controls.UnitTests.Mixins +{ + public class ContentControlMixinTests + { + [Fact] + public void Multiple_Mixin_Usages_Should_Not_Throw() + { + var target = new TestControl() + { + Template = new FuncControlTemplate(_ => new Panel + { + Children = + { + new ContentPresenter { Name = "Content_1_Presenter" }, + new ContentPresenter { Name = "Content_2_Presenter" } + } + }) + }; + + var ex = Record.Exception(() => target.ApplyTemplate()); + + Assert.Null(ex); + } + + [Fact] + public void Replacing_Template_Releases_Events() + { + var p1 = new ContentPresenter { Name = "Content_1_Presenter" }; + var p2 = new ContentPresenter { Name = "Content_2_Presenter" }; + var target = new TestControl + { + Template = new FuncControlTemplate(_ => new Panel + { + Children = + { + p1, + p2 + } + }) + }; + target.ApplyTemplate(); + + Control tc; + + p1.Content = tc = new Control(); + p1.UpdateChild(); + Assert.Contains(tc, target.GetLogicalChildren()); + + p2.Content = tc = new Control(); + p2.UpdateChild(); + Assert.Contains(tc, target.GetLogicalChildren()); + + target.Template = null; + + p1.Content = tc = new Control(); + p1.UpdateChild(); + Assert.DoesNotContain(tc, target.GetLogicalChildren()); + + p2.Content = tc = new Control(); + p2.UpdateChild(); + Assert.DoesNotContain(tc, target.GetLogicalChildren()); + + } + + private class TestControl : TemplatedControl + { + public static readonly StyledProperty Content1Property = + AvaloniaProperty.Register(nameof(Content1)); + + public static readonly StyledProperty Content2Property = + AvaloniaProperty.Register(nameof(Content2)); + + static TestControl() + { + ContentControlMixin.Attach(Content1Property, x => x.LogicalChildren, "Content_1_Presenter"); + ContentControlMixin.Attach(Content2Property, x => x.LogicalChildren, "Content_2_Presenter"); + } + + public object Content1 + { + get { return GetValue(Content1Property); } + set { SetValue(Content1Property, value); } + } + + public object Content2 + { + get { return GetValue(Content2Property); } + set { SetValue(Content2Property, value); } + } + } + } +} diff --git a/tests/Avalonia.Interactivity.UnitTests/RoutedEventRegistryTests.cs b/tests/Avalonia.Interactivity.UnitTests/RoutedEventRegistryTests.cs new file mode 100644 index 0000000000..b9ebdea064 --- /dev/null +++ b/tests/Avalonia.Interactivity.UnitTests/RoutedEventRegistryTests.cs @@ -0,0 +1,49 @@ +// Copyright (c) The Avalonia Project. All rights reserved. +// Licensed under the MIT license. See licence.md file in the project root for full license information. + +using System.Collections.Generic; +using Avalonia.Controls; +using Avalonia.Input; +using Xunit; + +namespace Avalonia.Interactivity.UnitTests +{ + public class RoutedEventRegistryTests + { + [Fact] + public void Pointer_Events_Should_Be_Registered() + { + var expectedEvents = new List { InputElement.PointerPressedEvent, InputElement.PointerReleasedEvent }; + var registeredEvents = RoutedEventRegistry.Instance.GetRegistered(); + Assert.Contains(registeredEvents, expectedEvents.Contains); + } + + [Fact] + public void ClickEvent_Should_Be_Registered_On_Button() + { + var expectedEvents = new List { Button.ClickEvent }; + var registeredEvents = RoutedEventRegistry.Instance.GetRegistered