aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs')
-rw-r--r--Software/Visual_Studio/SideChains/Tango.AutoComplete/Editors/AutoCompleteTextBox.cs63
1 files changed, 14 insertions, 49 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)
{