diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-12 13:17:41 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-11-12 13:17:41 +0200 |
| commit | a98e30ab93fd4717bbe49c0b2cb6dff4bc65a67c (patch) | |
| tree | 5b50d3ff60da99eedc1aad14af8e526539ed2c15 /Software/Visual_Studio/Tango.Touch/Controls | |
| parent | 739fd56662cdee59f42ec8d80654babf158b9f51 (diff) | |
| download | Tango-a98e30ab93fd4717bbe49c0b2cb6dff4bc65a67c.tar.gz Tango-a98e30ab93fd4717bbe49c0b2cb6dff4bc65a67c.zip | |
Working on PPC color catalog.
Diffstat (limited to 'Software/Visual_Studio/Tango.Touch/Controls')
3 files changed, 22 insertions, 2 deletions
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs index bea8f299e..d12be0e4c 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs @@ -792,6 +792,11 @@ namespace Tango.Touch.Controls return null; } + public Point GetElementPosition(FrameworkElement element) + { + return element.TranslatePoint(new Point(0, 0), this); + } + public T GetMostVisibleElementDataContext<T>() where T : class { var elements = _grid_content.FindVisualChildren<FrameworkElement>().Where(x => x.DataContext is T).ToList(); diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs index da5b44fa6..fd8f17367 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.cs @@ -107,7 +107,7 @@ namespace Tango.Touch.Controls public TouchAutoComplete() { - AutoCompleteProvider = new AutoCompleteProvider<Object>((obj, filter) => { return obj.ToString().ToLower().StartsWith(filter.ToLower()); }); + //AutoCompleteProvider = new AutoCompleteProvider<Object>((obj, filter) => { return obj.ToString().ToLower().StartsWith(filter.ToLower()); }); ItemSelectedCommand = new RelayCommand(() => OnSelectedItemChanged()); } @@ -136,6 +136,18 @@ namespace Tango.Touch.Controls private void _textBox_LostFocus(object sender, RoutedEventArgs e) { _popup.IsOpen = false; + + if (EffectiveItemsSource != null && EffectiveItemsSource.Count > 0 && SelectedItem == null) + { + SelectedItem = EffectiveItemsSource[0]; + + var binding = BindingOperations.GetBindingExpressionBase(this, SelectedItemProperty); + + if (binding != null) + { + binding.UpdateSource(); + } + } } private void _textBox_GotFocus(object sender, RoutedEventArgs e) @@ -152,6 +164,9 @@ namespace Tango.Touch.Controls { EffectiveItemsSource = AutoCompleteProvider.Filter(ItemsSource, Text); + SelectedItem = null; + + if (EffectiveItemsSource.Count > 0) { _popup.IsOpen = true; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml index 37d8e26a6..94efc967f 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchAutoComplete.xaml @@ -101,7 +101,7 @@ <Grid> <components:Ripple RippleBrush="{StaticResource TangoRippleDarkBrush}" RippleFactor="15"> <Grid> - <TextBox Foreground="{TemplateBinding Foreground}" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchAutoComplete},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent"></TextBox> + <TextBox Foreground="{TemplateBinding Foreground}" VerticalContentAlignment="Bottom" Padding="0 0 0 4" CaretBrush="{StaticResource TangoPrimaryAccentBrush}" FocusVisualStyle="{x:Null}" x:Name="PART_TextBox" Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchAutoComplete},Path=Text,UpdateSourceTrigger=PropertyChanged}" BorderThickness="0" Background="Transparent"></TextBox> <TextBlock IsHitTestVisible="False" Text="{TemplateBinding Watermark}" Foreground="{StaticResource TangoTextWatermarkBrush}"> <TextBlock.Style> <Style TargetType="TextBlock"> |
