aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-12 20:38:57 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-11-12 20:38:57 +0200
commit14e4bd850fa6730eecd7d15bd7044f364b41c986 (patch)
tree4e1945a18def6d1c91f239b2b4dbf6e11c0d51db /Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs
parent775f0015321f91aa5be3aca079e289e89d4719f5 (diff)
downloadTango-14e4bd850fa6730eecd7d15bd7044f364b41c986.tar.gz
Tango-14e4bd850fa6730eecd7d15bd7044f364b41c986.zip
Working on data store view.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs')
-rw-r--r--Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs
index 583d7b810..1f2856a32 100644
--- a/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs
+++ b/Software/Visual_Studio/Tango.SharedUI/Controls/SearchComboBox.cs
@@ -12,6 +12,7 @@ using System.Windows.Input;
using System.Linq;
using System.Windows.Media;
using System.Windows.Threading;
+using Tango.Core.ExtensionMethods;
namespace Tango.SharedUI.Controls
{
@@ -73,6 +74,11 @@ namespace Tango.SharedUI.Controls
{
IsOpened = false;
SelectedItem = _listBox.SelectedItem;
+
+ if (SelectedValuePath.IsNotNullOrEmpty() && SelectedItem != null)
+ {
+ SelectedValue = SelectedItem.GetPropertyValueByPath(SelectedValuePath);
+ }
}
else if (e.Key == Key.Up && _listBox.SelectedIndex == 0)
{
@@ -120,6 +126,11 @@ namespace Tango.SharedUI.Controls
{
IsOpened = false;
SelectedItem = _listBox.SelectedItem;
+
+ if (SelectedValuePath.IsNotNullOrEmpty() && SelectedItem != null)
+ {
+ SelectedValue = SelectedItem.GetPropertyValueByPath(SelectedValuePath);
+ }
}
}
}
@@ -152,12 +163,17 @@ namespace Tango.SharedUI.Controls
if (x != null)
{
- var prop = x.GetType().GetProperty(SearchProperty, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
- if (prop != null)
+ if (!String.IsNullOrWhiteSpace(SearchProperty))
{
- String propValue = prop.GetValue(x).ToString();
- return propValue.ToLower().Contains(SearchFilter.ToLower());
+ var prop = x.GetType().GetProperty(SearchProperty, System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
+ if (prop != null)
+ {
+ String propValue = prop.GetValue(x).ToString();
+ return propValue.ToLower().Contains(SearchFilter.ToLower());
+ }
}
+
+ return x.ToStringSafe().ToLower().Contains(SearchFilter.ToLower());
}
return false;