From b6698825fc2d1f7c353a4a53834e07d7b4e5e90e Mon Sep 17 00:00:00 2001 From: robloo Date: Fri, 14 Oct 2022 20:21:47 -0400 Subject: [PATCH] Modernize some code formatting in AutoCompleteBox --- src/Avalonia.Controls/AutoCompleteBox.cs | 82 +++++++++++------------- 1 file changed, 39 insertions(+), 43 deletions(-) diff --git a/src/Avalonia.Controls/AutoCompleteBox.cs b/src/Avalonia.Controls/AutoCompleteBox.cs index 3cf7a56c58..e7a14bf568 100644 --- a/src/Avalonia.Controls/AutoCompleteBox.cs +++ b/src/Avalonia.Controls/AutoCompleteBox.cs @@ -898,8 +898,8 @@ namespace Avalonia.Controls /// public int MinimumPrefixLength { - get { return GetValue(MinimumPrefixLengthProperty); } - set { SetValue(MinimumPrefixLengthProperty, value); } + get => GetValue(MinimumPrefixLengthProperty); + set => SetValue(MinimumPrefixLengthProperty, value); } /// @@ -914,8 +914,8 @@ namespace Avalonia.Controls /// public bool IsTextCompletionEnabled { - get { return GetValue(IsTextCompletionEnabledProperty); } - set { SetValue(IsTextCompletionEnabledProperty, value); } + get => GetValue(IsTextCompletionEnabledProperty); + set => SetValue(IsTextCompletionEnabledProperty, value); } /// @@ -934,8 +934,8 @@ namespace Avalonia.Controls /// public IDataTemplate ItemTemplate { - get { return GetValue(ItemTemplateProperty); } - set { SetValue(ItemTemplateProperty, value); } + get => GetValue(ItemTemplateProperty); + set => SetValue(ItemTemplateProperty, value); } /// @@ -950,8 +950,8 @@ namespace Avalonia.Controls /// the list of possible matches in the drop-down. The default is 0. public TimeSpan MinimumPopulateDelay { - get { return GetValue(MinimumPopulateDelayProperty); } - set { SetValue(MinimumPopulateDelayProperty, value); } + get => GetValue(MinimumPopulateDelayProperty); + set => SetValue(MinimumPopulateDelayProperty, value); } /// @@ -964,8 +964,8 @@ namespace Avalonia.Controls /// The specified value is less than 0. public double MaxDropDownHeight { - get { return GetValue(MaxDropDownHeightProperty); } - set { SetValue(MaxDropDownHeightProperty, value); } + get => GetValue(MaxDropDownHeightProperty); + set => SetValue(MaxDropDownHeightProperty, value); } /// @@ -978,8 +978,8 @@ namespace Avalonia.Controls /// public bool IsDropDownOpen { - get { return _isDropDownOpen; } - set { SetAndRaise(IsDropDownOpenProperty, ref _isDropDownOpen, value); } + get => _isDropDownOpen; + set => SetAndRaise(IsDropDownOpenProperty, ref _isDropDownOpen, value); } /// @@ -993,7 +993,7 @@ namespace Avalonia.Controls [AssignBinding] public IBinding? ValueMemberBinding { - get { return _valueBindingEvaluator?.ValueBinding; } + get => _valueBindingEvaluator?.ValueBinding; set { if (ValueMemberBinding != value) @@ -1016,8 +1016,8 @@ namespace Avalonia.Controls /// public object? SelectedItem { - get { return _selectedItem; } - set { SetAndRaise(SelectedItemProperty, ref _selectedItem, value); } + get => _selectedItem; + set => SetAndRaise(SelectedItemProperty, ref _selectedItem, value); } /// @@ -1028,8 +1028,8 @@ namespace Avalonia.Controls /// control. public string? Text { - get { return _text; } - set { SetAndRaise(TextProperty, ref _text, value); } + get => _text; + set => SetAndRaise(TextProperty, ref _text, value); } /// @@ -1047,7 +1047,7 @@ namespace Avalonia.Controls /// public string? SearchText { - get { return _searchText; } + get => _searchText; private set { try @@ -1083,14 +1083,14 @@ namespace Avalonia.Controls /// public AutoCompleteFilterMode FilterMode { - get { return GetValue(FilterModeProperty); } - set { SetValue(FilterModeProperty, value); } + get => GetValue(FilterModeProperty); + set => SetValue(FilterModeProperty, value); } public string? Watermark { - get { return GetValue(WatermarkProperty); } - set { SetValue(WatermarkProperty, value); } + get => GetValue(WatermarkProperty); + set => SetValue(WatermarkProperty, value); } /// @@ -1109,8 +1109,8 @@ namespace Avalonia.Controls /// public AutoCompleteFilterPredicate? ItemFilter { - get { return _itemFilter; } - set { SetAndRaise(ItemFilterProperty, ref _itemFilter, value); } + get => _itemFilter; + set => SetAndRaise(ItemFilterProperty, ref _itemFilter, value); } /// @@ -1129,8 +1129,8 @@ namespace Avalonia.Controls /// public AutoCompleteFilterPredicate? TextFilter { - get { return _textFilter; } - set { SetAndRaise(TextFilterProperty, ref _textFilter, value); } + get => _textFilter; + set => SetAndRaise(TextFilterProperty, ref _textFilter, value); } /// @@ -1145,8 +1145,8 @@ namespace Avalonia.Controls /// public AutoCompleteSelector? ItemSelector { - get { return _itemSelector; } - set { SetAndRaise(ItemSelectorProperty, ref _itemSelector, value); } + get => _itemSelector; + set => SetAndRaise(ItemSelectorProperty, ref _itemSelector, value); } /// @@ -1163,14 +1163,14 @@ namespace Avalonia.Controls /// public AutoCompleteSelector? TextSelector { - get { return _textSelector; } - set { SetAndRaise(TextSelectorProperty, ref _textSelector, value); } + get => _textSelector; + set => SetAndRaise(TextSelectorProperty, ref _textSelector, value); } public Func>>? AsyncPopulator { - get { return _asyncPopulator; } - set { SetAndRaise(AsyncPopulatorProperty, ref _asyncPopulator, value); } + get => _asyncPopulator; + set => SetAndRaise(AsyncPopulatorProperty, ref _asyncPopulator, value); } /// @@ -1183,8 +1183,8 @@ namespace Avalonia.Controls /// control. public IEnumerable? Items { - get { return _itemsEnumerable; } - set { SetAndRaise(ItemsProperty, ref _itemsEnumerable, value); } + get => _itemsEnumerable; + set => SetAndRaise(ItemsProperty, ref _itemsEnumerable, value); } /// @@ -1197,7 +1197,7 @@ namespace Avalonia.Controls /// private TextBox? TextBox { - get { return _textBox; } + get => _textBox; set { _textBoxSubscriptions?.Dispose(); @@ -1261,7 +1261,7 @@ namespace Avalonia.Controls /// protected ISelectionAdapter? SelectionAdapter { - get { return _adapter; } + get => _adapter; set { if (_adapter != null) @@ -2748,8 +2748,6 @@ namespace Avalonia.Controls /// private IBinding? _binding; - #region public T Value - /// /// Identifies the Value dependency property. /// @@ -2761,18 +2759,16 @@ namespace Avalonia.Controls /// public T Value { - get { return GetValue(ValueProperty); } - set { SetValue(ValueProperty, value); } + get => GetValue(ValueProperty); + set => SetValue(ValueProperty, value); } - #endregion public string Value - /// /// Gets or sets the value binding. /// public IBinding? ValueBinding { - get { return _binding; } + get => _binding; set { _binding = value;