添加项目文件。
This commit is contained in:
42
Sai.Toolkit.Mvvm/AttachedProps/TextSearch.cs
Normal file
42
Sai.Toolkit.Mvvm/AttachedProps/TextSearch.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Sai.Toolkit.Mvvm.AttachedProps;
|
||||
|
||||
public class TextSearch
|
||||
{
|
||||
// Using a DependencyProperty as the backing store for IsTextMatch. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty IsTextMatchProperty = DependencyProperty.RegisterAttached(
|
||||
"IsTextMatch",
|
||||
typeof(bool),
|
||||
typeof(TextSearch),
|
||||
new UIPropertyMetadata(false)
|
||||
);
|
||||
|
||||
// Using a DependencyProperty as the backing store for SearchValue. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty SearchValueProperty = DependencyProperty.RegisterAttached(
|
||||
"SearchValue",
|
||||
typeof(string),
|
||||
typeof(TextSearch),
|
||||
new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.Inherits)
|
||||
);
|
||||
|
||||
public static bool GetIsTextMatch(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(IsTextMatchProperty);
|
||||
}
|
||||
|
||||
public static string GetSearchValue(DependencyObject obj)
|
||||
{
|
||||
return (string)obj.GetValue(SearchValueProperty);
|
||||
}
|
||||
|
||||
public static void SetIsTextMatch(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(IsTextMatchProperty, value);
|
||||
}
|
||||
|
||||
public static void SetSearchValue(DependencyObject obj, string value)
|
||||
{
|
||||
obj.SetValue(SearchValueProperty, value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user