aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/Tango.AutoComplete
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/SideChains/Tango.AutoComplete
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/SideChains/Tango.AutoComplete')
-rw-r--r--Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs63
-rw-r--r--Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml1
2 files changed, 14 insertions, 50 deletions
diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs
index 78e62d399..253843a57 100644
--- a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs
+++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs
@@ -18,8 +18,6 @@ namespace Tango.AutoComplete.Editors
public class AutoCompleteTextBox : Control
{
- private ContentControl _partSelectedContent;
-
#region "Fields"
public const string PartEditor = "PART_Editor";
@@ -67,7 +65,7 @@ namespace Tango.AutoComplete.Editors
private SuggestionsAdapter _suggestionsAdapter;
-
+
#endregion
#region "Constructors"
@@ -81,22 +79,14 @@ namespace Tango.AutoComplete.Editors
#region "Properties"
- public DataTemplate SelectedItemTemplate
- {
- get { return (DataTemplate)GetValue(SelectedItemTemplateProperty); }
- set { SetValue(SelectedItemTemplateProperty, value); }
- }
- public static readonly DependencyProperty SelectedItemTemplateProperty =
- DependencyProperty.Register("SelectedItemTemplate", typeof(DataTemplate), typeof(AutoCompleteTextBox), new PropertyMetadata(null));
-
-
+
public int MaxPopupHeight
{
- get { return (int)GetValue(MaxPopUpHeightProperty); }
- set { SetValue(MaxPopUpHeightProperty, value); }
+ get { return (int) GetValue(MaxPopUpHeightProperty); }
+ set { SetValue(MaxPopUpHeightProperty, value);}
}
-
+
public BindingEvaluator BindingEvaluator
{
get { return _bindingEvaluator; }
@@ -105,13 +95,13 @@ namespace Tango.AutoComplete.Editors
public CharacterCasing CharacterCasing
{
- get { return (System.Windows.Controls.CharacterCasing)GetValue(CharacterCasingProperty); }
- set { SetValue(CharacterCasingProperty, value); }
+ get { return (System.Windows.Controls.CharacterCasing) GetValue(CharacterCasingProperty); }
+ set { SetValue(CharacterCasingProperty, value);}
}
public int MaxLength
{
- get { return (int)GetValue(DelayProperty); }
+ get { return (int) GetValue(DelayProperty); }
set { SetValue(MaxLengthProperty, value); }
}
@@ -257,8 +247,7 @@ namespace Tango.AutoComplete.Editors
set { SetValue(WatermarkProperty, value); }
}
- public Brush SuggestionBackground
- {
+ public Brush SuggestionBackground {
get { return (Brush)GetValue(SuggestionBackgroundProperty); }
set { SetValue(SuggestionBackgroundProperty, value); }
@@ -274,33 +263,12 @@ namespace Tango.AutoComplete.Editors
act = d as AutoCompleteTextBox;
if (act != null)
{
- act.InvalidateSelection();
- }
- }
-
- private void InvalidateSelection()
- {
- if (Editor != null & !_isUpdatingText)
- {
- _isUpdatingText = true;
- Editor.Text = BindingEvaluator.Evaluate(SelectedItem);
- Keyboard.ClearFocus();
-
- if (_partSelectedContent != null)
+ if (act.Editor != null & !act._isUpdatingText)
{
- if (SelectedItem == null)
- {
- _partSelectedContent.Visibility = Visibility.Collapsed;
- Editor.Foreground = Application.Current.Resources["FSE_PrimaryForegroundBrush"] as Brush;
- }
- else
- {
- _partSelectedContent.Visibility = Visibility.Visible;
- Editor.Foreground = Brushes.Transparent;
- }
+ act._isUpdatingText = true;
+ act.Editor.Text = act.BindingEvaluator.Evaluate(e.NewValue);
+ act._isUpdatingText = false;
}
-
- _isUpdatingText = false;
}
}
@@ -311,7 +279,7 @@ namespace Tango.AutoComplete.Editors
listBox.ScrollIntoView(listBox.SelectedItem);
}
-
+
public override void OnApplyTemplate()
{
_isUpdatingText = true;
@@ -321,7 +289,6 @@ namespace Tango.AutoComplete.Editors
Editor = Template.FindName(PartEditor, this) as TextBox;
Popup = Template.FindName(PartPopup, this) as Popup;
ItemsSelector = Template.FindName(PartSelector, this) as Selector;
- _partSelectedContent = Template.FindName("PART_SelectedContent", this) as ContentControl;
BindingEvaluator = new BindingEvaluator(new Binding(DisplayMember));
if (Editor != null)
@@ -355,8 +322,6 @@ namespace Tango.AutoComplete.Editors
}
_isUpdatingText = false;
-
- InvalidateSelection();
}
private void ItemsSelector_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
diff --git a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml
index 4e12f40fc..25667d1d1 100644
--- a/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml
+++ b/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/Themes/Generic.xaml
@@ -110,7 +110,6 @@
<ListBox x:Name="PART_Selector"
ItemTemplate="{TemplateBinding ItemTemplate}"
ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"
- DisplayMemberPath="{TemplateBinding DisplayMember}"
Focusable="False"
BorderThickness="0"
MaxHeight="{Binding Path=MaxPopupHeight, RelativeSource={RelativeSource Mode=TemplatedParent},Mode=TwoWay}"