-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7594 from pr8x/text-search-property
Implement `TextSearch.Text`
- Loading branch information
Showing
3 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using Avalonia.Interactivity; | ||
|
||
namespace Avalonia.Controls.Primitives | ||
{ | ||
/// <summary> | ||
/// Allows to customize text searching in <see cref="SelectingItemsControl"/>. | ||
/// </summary> | ||
public static class TextSearch | ||
{ | ||
/// <summary> | ||
/// Defines the Text attached property. | ||
/// This text will be considered during text search in <see cref="SelectingItemsControl"/> (such as <see cref="ComboBox"/>) | ||
/// </summary> | ||
public static readonly AttachedProperty<string> TextProperty | ||
= AvaloniaProperty.RegisterAttached<Interactive, string>("Text", typeof(TextSearch)); | ||
|
||
/// <summary> | ||
/// Sets the <see cref="TextProperty"/> for a control. | ||
/// </summary> | ||
/// <param name="control">The control</param> | ||
/// <param name="text">The search text to set</param> | ||
public static void SetText(Control control, string text) | ||
{ | ||
control.SetValue(TextProperty, text); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="TextProperty"/> of a control. | ||
/// </summary> | ||
/// <param name="control">The control</param> | ||
/// <returns>The property value</returns> | ||
public static string GetText(Control control) | ||
{ | ||
return control.GetValue(TextProperty); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters