csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
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);
|
|
}
|
|
}
|
|
}
|
|
|