diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-08-05 00:28:12 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-08-05 00:28:12 +0300 |
| commit | 054b6ca55142fae5bb30a9b8f3301f7e71a92296 (patch) | |
| tree | 13cd2dd8ba72af9b78a98ac56d1785a423be0e89 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 064bb0517aa7f8a1906761ae099cf44b785cff9f (diff) | |
| download | Tango-054b6ca55142fae5bb30a9b8f3301f7e71a92296.tar.gz Tango-054b6ca55142fae5bb30a9b8f3301f7e71a92296.zip | |
Added a new control SearchComboBox. Refactoring code filter of RmlsCollectionView.
Related Work Items: #3286
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
2 files changed, 12 insertions, 18 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml index 35c621822..5b29fd432 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml @@ -756,7 +756,7 @@ <StackPanel> <TextBlock>MEDIA</TextBlock> <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> - <ComboBox Width="250" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" Style="{StaticResource TransparentComboBoxStyle}" HorizontalContentAlignment="Stretch"> + <controls:SearchComboBox Width="250" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}" HorizontalContentAlignment="Stretch" SearchParam="Name"> <ComboBox.ItemTemplate> <DataTemplate> <DockPanel> @@ -771,7 +771,7 @@ </DockPanel> </DataTemplate> </ComboBox.ItemTemplate> - </ComboBox> + </controls:SearchComboBox> <!--<Button Margin="20 30 0 0" Command="{Binding EditRMLCommand}" HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs index c31c95800..229d62df7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs @@ -34,7 +34,6 @@ namespace Tango.MachineStudio.RML.ViewModels private IAuthenticationProvider _authentication; private IActionLogManager _actionLogManager; private RmlDTO _rmlBeforeSave; - private static object _syncLock = new object(); private ObservablesContext _rmls_context; private ObservablesContext _active_context; @@ -56,8 +55,6 @@ namespace Tango.MachineStudio.RML.ViewModels set { _rmlssCollectionView = value; - BindingOperations.EnableCollectionSynchronization(_rmlssCollectionView, _syncLock); - RaisePropertyChangedAuto(); } } @@ -311,6 +308,15 @@ namespace Tango.MachineStudio.RML.ViewModels } RmlsCollectionView = CollectionViewSource.GetDefaultView(Rmls); RmlsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Rml.LastUpdated), ListSortDirection.Descending)); + //RmlsCollectionView.Filter = new Predicate<object>(FilterCollection); + + RmlsCollectionView.Filter = (rml) => + { + Rml r = rml as Rml; + return String.IsNullOrWhiteSpace(RMLFilter) + || r.Name.ToLower().Contains(RMLFilter.ToLower()) //Rml name + || (r.MediaMaterial != null && r.MediaMaterial.Name.ToLower().Contains(RMLFilter.ToLower())); + }; } private async void LoadActiveRML(String guid) @@ -683,19 +689,7 @@ namespace Tango.MachineStudio.RML.ViewModels private void OnRMLFilterChanged() { - String filter = RMLFilter.ToLower(); - - RmlsCollectionView.Filter = (rml) => - { - Rml r = rml as Rml; - return String.IsNullOrWhiteSpace(filter) - || - r.Name.ToLower().Contains(filter) //Rml name - || - (r.MediaMaterial != null && r.MediaMaterial.Name.ToLower().Contains(filter)) // Material name - || - (r.Cct != null && r.Cct.FileName != null && r.Cct.FileName.ToString().Contains(filter)); //Cct.FileName - }; + RmlsCollectionView.Refresh(); } private void RemoveLiquidFactor(LiquidTypesRml liquidFactor) |
