diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml b/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml
index d1b93c99b..94c89335c 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml
@@ -4,12 +4,13 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Wpf.Ui.Gallery.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:Wpf.Ui.Gallery.Views.Pages.Text"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
+ xmlns:text="clr-namespace:Wpf.Ui.Gallery.ViewModels.Pages.Text"
+ xmlns:text1="clr-namespace:Wpf.Ui.Gallery.Views.Pages.Text"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
Title="AutoSuggestBoxPage"
- d:DataContext="{d:DesignInstance local:AutoSuggestBoxPage,
+ d:DataContext="{d:DesignInstance text1:AutoSuggestBoxPage,
IsDesignTimeCreatable=False}"
d:DesignHeight="450"
d:DesignWidth="800"
@@ -27,6 +28,7 @@
x:Name="PageScrollViewer"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
+
@@ -38,17 +40,20 @@
+
-
+
+
+
diff --git a/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml.cs b/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml.cs
index 9e7d1fce0..36a12c926 100644
--- a/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml.cs
+++ b/src/Wpf.Ui.Gallery/Views/Pages/Text/AutoSuggestBoxPage.xaml.cs
@@ -3,7 +3,6 @@
// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
// All Rights Reserved.
-
using Wpf.Ui.Controls.Navigation;
using Wpf.Ui.Gallery.ViewModels.Pages.Text;
diff --git a/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml b/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml
index 1fe7ea3e8..349a749f4 100644
--- a/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml
+++ b/src/Wpf.Ui.Gallery/Views/Windows/MainWindow.xaml
@@ -20,6 +20,14 @@
WindowCornerPreference="Default"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
+
+
+
+
+
@@ -40,9 +48,8 @@
diff --git a/src/Wpf.Ui/Controls/AutoSuggestBox.cs b/src/Wpf.Ui/Controls/AutoSuggestBox.cs
deleted file mode 100644
index 4357fe099..000000000
--- a/src/Wpf.Ui/Controls/AutoSuggestBox.cs
+++ /dev/null
@@ -1,353 +0,0 @@
-// This Source Code Form is subject to the terms of the MIT License.
-// If a copy of the MIT was not distributed with this file, You can obtain one at https://opensource.org/licenses/MIT.
-// Copyright (C) Leszek Pomianowski and WPF UI Contributors.
-// All Rights Reserved.
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Controls.Primitives;
-using System.Windows.Input;
-
-namespace Wpf.Ui.Controls;
-
-// TODO: Fix closing and loosing focus
-
-///
-/// Represents a text control that makes suggestions to users as they enter text using a keyboard.
-///
-[ToolboxItem(true)]
-[ToolboxBitmap(typeof(AutoSuggestBox), "AutoSuggestBox.bmp")]
-[TemplatePart(Name = "PART_Popup", Type = typeof(System.Windows.Controls.Primitives.Popup))]
-[TemplatePart(Name = "PART_SuggestionsPresenter", Type = typeof(System.Windows.Controls.ListView))]
-public class AutoSuggestBox : Wpf.Ui.Controls.TextBox
-{
- ///
- /// The current text in used for validation purposes.
- ///
- private string _currentText = String.Empty;
-
- ///
- /// Template element represented by the PART_Popup name.
- ///
- private const string ElementPopup = "PART_Popup";
-
- ///
- /// Template element represented by the PART_SuggestionsPresenter name.
- ///
- private const string ElementSuggestionsPresenter = "PART_SuggestionsPresenter";
-
- ///
- /// Popup with suggestions.
- ///
- protected Popup? Popup { get; private set; }
-
- ///
- /// List of suggestions inside .
- ///
- protected ListView? SuggestionsPresenter { get; private set; }
-
- ///
- /// Property for .
- ///
- public static readonly DependencyProperty ItemsSourceProperty = DependencyProperty.Register(nameof(ItemsSource),
- typeof(object), typeof(AutoSuggestBox),
- new PropertyMetadata(null!, OnItemsSourceChanged));
-
- ///
- /// Property for .
- ///
- public static readonly DependencyProperty FilteredItemsSourceProperty = DependencyProperty.Register(nameof(FilteredItemsSource),
- typeof(object), typeof(AutoSuggestBox),
- new PropertyMetadata(null!));
-
- ///
- /// Property for .
- ///
- public static readonly DependencyProperty IsSuggestionListOpenProperty = DependencyProperty.Register(nameof(IsSuggestionListOpen),
- typeof(bool), typeof(AutoSuggestBox),
- new PropertyMetadata(false));
-
- ///
- /// Property for .
- ///
- public static readonly DependencyProperty MaxDropDownHeightProperty = DependencyProperty.Register(nameof(MaxDropDownHeight),
- typeof(double), typeof(AutoSuggestBox),
- new PropertyMetadata(240d));
-
- ///
- /// Routed event for .
- ///
- public static readonly RoutedEvent QuerySubmittedEvent = EventManager.RegisterRoutedEvent(
- nameof(QuerySubmitted), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AutoSuggestBox));
-
- ///
- /// Routed event for .
- ///
- public static readonly RoutedEvent SuggestionChosenEvent = EventManager.RegisterRoutedEvent(
- nameof(SuggestionChosen), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(AutoSuggestBox));
-
- ///
- /// does no accept returns.
- ///
- public new bool AcceptsReturn
- {
- get => false;
- set => throw new NotImplementedException($"{typeof(AutoSuggestBox)} does not accept returns.");
- }
-
- ///
- /// does not accept changes to the number of lines.
- ///
- public new int MaxLines
- {
- get => 1;
- set => throw new NotImplementedException($"{typeof(AutoSuggestBox)} does not accept changes to the number of lines.");
- }
-
- ///
- /// does not accept changes to the number of lines.
- ///
- public new int MinLines
- {
- get => 1;
- set => throw new NotImplementedException($"{typeof(AutoSuggestBox)} does not accept changes to the number of lines.");
- }
-
- ///
- /// ItemsSource specifies a collection used to generate the list of suggestions
- /// for .
- ///
- [Bindable(true)]
- public object ItemsSource
- {
- get => GetValue(ItemsSourceProperty);
- set
- {
- if (value == null)
- ClearValue(ItemsSourceProperty);
- else
- SetValue(ItemsSourceProperty, value);
- }
- }
-
- ///
- /// Filtered based on provided text.
- ///
- public object FilteredItemsSource
- {
- get => GetValue(FilteredItemsSourceProperty);
- private set
- {
- if (value == null)
- ClearValue(FilteredItemsSourceProperty);
- else
- SetValue(FilteredItemsSourceProperty, value);
- }
- }
-
- ///
- /// Gets or sets a value representing whether the suggestion list should be opened.
- ///
- public bool IsSuggestionListOpen
- {
- get => (bool)GetValue(IsSuggestionListOpenProperty);
- set => SetValue(IsSuggestionListOpenProperty, value);
- }
-
- ///
- /// Gets or sets the maximum height of the drop-down list with suggestions.
- ///
- public double MaxDropDownHeight
- {
- get => (double)GetValue(MaxDropDownHeightProperty);
- set => SetValue(MaxDropDownHeightProperty, value);
- }
-
- ///
- /// Event occurs when a user commits a query string.
- ///
- public event RoutedEventHandler QuerySubmitted
- {
- add => AddHandler(QuerySubmittedEvent, value);
- remove => RemoveHandler(QuerySubmittedEvent, value);
- }
-
- ///
- /// Event occurs when the user selects an item from the recommended ones.
- ///
- public event RoutedEventHandler SuggestionChosen
- {
- add => AddHandler(SuggestionChosenEvent, value);
- remove => RemoveHandler(SuggestionChosenEvent, value);
- }
-
- ///
- /// Gets the suggested result that the user chose.
- ///
- public object? ChosenSuggestion { get; protected set; } = null;
-
- ///
- /// Invoked whenever application code or an internal process,
- /// such as a rebuilding layout pass, calls the ApplyTemplate method.
- ///
- public override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
-
- if (GetTemplateChild(ElementPopup) is Popup popup)
- Popup = popup;
-
- if (GetTemplateChild(ElementSuggestionsPresenter) is ListView listView)
- SuggestionsPresenter = listView;
-
- if (SuggestionsPresenter == null!)
- return;
-
- SuggestionsPresenter.SelectionChanged += OnSuggestionsPresenterSelectionChanged;
- SuggestionsPresenter.LostFocus += OnSuggestionsPresenterLostFocus;
- }
-
- ///
- protected override void OnTextChanged(TextChangedEventArgs e)
- {
- base.OnTextChanged(e);
-
- if (ItemsSource is not ICollection itemsSourceCollection)
- return;
-
- var newText = Text;
-
- if (_currentText == newText)
- return;
-
- _currentText = newText;
-
- if (String.IsNullOrEmpty(newText))
- {
- FilteredItemsSource = ItemsSource;
- }
- else
- {
- var formattedNewText = newText.ToLower();
-
- var filteredCollection = new List