add ignoreTextChanged

This commit is contained in:
NaBian committed 2021-09-08 00:08:56 +08:00
1 parent fbaeb194e8
commit eea87ad879
34 files changed
+733 -6

No files matched your search

@@ -0,0 +1,31 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace HandyControl.Tools.Helper
{
public class BindingHelper
{
public static string GetString(object source, string path)
{
if (string.IsNullOrEmpty(path))
{
return source == null ? string.Empty : source.ToString();
}
var tempObj = new DependencyObject();
var binding = new Binding(path)
{
Mode = BindingMode.OneTime,
Source = source
};
BindingOperations.SetBinding(tempObj, TextSearch.TextProperty, binding);
var result = (string) tempObj.GetValue(TextSearch.TextProperty);
BindingOperations.ClearBinding(tempObj, TextSearch.TextProperty);
return result;
}
}
}