Skip to content

Commit 06736f5

Browse files
authored
Fixed AutoSuggestion event. (#460)
1 parent f5c299b commit 06736f5

File tree

4 files changed

+11
-26
lines changed

4 files changed

+11
-26
lines changed

ModernWpf.Controls/AutoSuggestBox/AutoSuggestBox.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ private void OnDelayTimerTick(object sender, EventArgs e)
334334
if (m_delayTimer.Tag is AutoSuggestionBoxTextChangeReason reason)
335335
{
336336
m_delayTimer.Tag = null;
337-
TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs(this, Text) { Reason = reason });
337+
TextChanged?.Invoke(this, new AutoSuggestBoxTextChangedEventArgs(this, Text, reason));
338338
}
339339
}
340340

ModernWpf.Controls/AutoSuggestBox/AutoSuggestBoxQuerySubmittedEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System.Windows;
1+
using System;
22

33
namespace ModernWpf.Controls
44
{
5-
public sealed class AutoSuggestBoxQuerySubmittedEventArgs : DependencyObject
5+
public sealed class AutoSuggestBoxQuerySubmittedEventArgs : EventArgs
66
{
77
public AutoSuggestBoxQuerySubmittedEventArgs()
88
{

ModernWpf.Controls/AutoSuggestBox/AutoSuggestBoxSuggestionChosenEventArgs.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
using System.Windows;
1+
using System;
22

33
namespace ModernWpf.Controls
44
{
5-
public sealed class AutoSuggestBoxSuggestionChosenEventArgs : DependencyObject
5+
public sealed class AutoSuggestBoxSuggestionChosenEventArgs : EventArgs
66
{
77
public AutoSuggestBoxSuggestionChosenEventArgs()
88
{

ModernWpf.Controls/AutoSuggestBox/AutoSuggestBoxTextChangedEventArgs.cs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Windows;
32

43
namespace ModernWpf.Controls
54
{
@@ -10,35 +9,21 @@ public enum AutoSuggestionBoxTextChangeReason
109
SuggestionChosen = 2
1110
}
1211

13-
public sealed class AutoSuggestBoxTextChangedEventArgs : DependencyObject
12+
public sealed class AutoSuggestBoxTextChangedEventArgs : EventArgs
1413
{
1514
public AutoSuggestBoxTextChangedEventArgs()
1615
{
1716
}
1817

19-
internal AutoSuggestBoxTextChangedEventArgs(AutoSuggestBox source, string value)
18+
internal AutoSuggestBoxTextChangedEventArgs(AutoSuggestBox source, string value, AutoSuggestionBoxTextChangeReason reason)
2019
{
2120
m_source = new WeakReference<AutoSuggestBox>(source);
2221
m_value = value;
22+
Reason = reason;
2323
}
24-
25-
#region Reason
26-
27-
public static readonly DependencyProperty ReasonProperty =
28-
DependencyProperty.Register(
29-
nameof(Reason),
30-
typeof(AutoSuggestionBoxTextChangeReason),
31-
typeof(AutoSuggestBoxTextChangedEventArgs),
32-
new PropertyMetadata(AutoSuggestionBoxTextChangeReason.ProgrammaticChange));
33-
34-
public AutoSuggestionBoxTextChangeReason Reason
35-
{
36-
get => (AutoSuggestionBoxTextChangeReason)GetValue(ReasonProperty);
37-
set => SetValue(ReasonProperty, value);
38-
}
39-
40-
#endregion
41-
24+
25+
public AutoSuggestionBoxTextChangeReason Reason { get; }
26+
4227
public bool CheckCurrent()
4328
{
4429
return m_source != null &&

0 commit comments

Comments
 (0)