diff --git a/MainDemo.Wpf/ComboBoxes.xaml b/MainDemo.Wpf/ComboBoxes.xaml index fdf702520a..6fbcac2fb9 100644 --- a/MainDemo.Wpf/ComboBoxes.xaml +++ b/MainDemo.Wpf/ComboBoxes.xaml @@ -152,7 +152,7 @@ Fill="{DynamicResource MaterialDesignDivider}" /> + Text="ComboBoxes with long lists"/> @@ -160,7 +160,7 @@ @@ -174,12 +174,6 @@ - - - - - - @@ -188,7 +182,7 @@ + ItemsSource="{Binding LongIntegerList}"> @@ -196,22 +190,12 @@ - - - - - - - - - - @@ -219,32 +203,27 @@ materialDesign:HintAssist.FloatingScale="1.5" materialDesign:HintAssist.FloatingOffset="0, -24" MinWidth="72" - ItemsSource="{Binding LongListToTestComboVirtualization}" + ItemsSource="{Binding LongIntegerList}" Style="{StaticResource MaterialDesignFloatingHintComboBox}"> - - - - - - - - - - + + + ComboBoxes are virtualized by default in the library + + --> + + + + + + + DataGridComboBoxColumns are virtualized by default in the library + (Enumerable.Range(0, 1000)); + LongIntegerList = new List(Enumerable.Range(0, 1000)); ShortStringList = new[] { "Item 1", @@ -20,8 +21,15 @@ public ComboBoxesViewModel() "Item 3" }; - SelectedValueOne = LongListToTestComboVirtualization.Skip(2).First(); + SelectedValueOne = LongIntegerList.Skip(2).First(); SelectedTextTwo = null; + + LongStringList = new List(); + + for(int i = 0; i < 1000; i++) + { + LongStringList.Add(Path.GetRandomFileName()); + } } public int? SelectedValueOne @@ -48,7 +56,8 @@ public string? SelectedValidationOutlined set => SetProperty(ref _selectedValidationOutlined, value); } - public IList LongListToTestComboVirtualization { get; } + public IList LongIntegerList { get; } public IList ShortStringList { get; } + public IList LongStringList { get; } } } diff --git a/MainDemo.Wpf/Domain/ListsAndGridsViewModel.cs b/MainDemo.Wpf/Domain/ListsAndGridsViewModel.cs index 098ff69a42..15de553004 100644 --- a/MainDemo.Wpf/Domain/ListsAndGridsViewModel.cs +++ b/MainDemo.Wpf/Domain/ListsAndGridsViewModel.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; +using System.IO; using System.Linq; namespace MaterialDesignDemo.Domain @@ -20,6 +21,13 @@ public ListsAndGridsViewModel() OnPropertyChanged(nameof(IsAllItems1Selected)); }; } + + Files = new List(); + + for (int i = 0; i < 1000; i++) + { + Files.Add(Path.GetRandomFileName()); + } } public bool? IsAllItems1Selected @@ -78,5 +86,8 @@ private static ObservableCollection CreateData() public ObservableCollection Items3 { get; } public IEnumerable Foods => new[] { "Burger", "Fries", "Shake", "Lettuce" }; + + public IList Files { get; } + } } \ No newline at end of file diff --git a/MainDemo.Wpf/Domain/SelectableViewModel.cs b/MainDemo.Wpf/Domain/SelectableViewModel.cs index 478b77f6b1..85445a329b 100644 --- a/MainDemo.Wpf/Domain/SelectableViewModel.cs +++ b/MainDemo.Wpf/Domain/SelectableViewModel.cs @@ -8,6 +8,7 @@ public class SelectableViewModel : ViewModelBase private char _code; private double _numeric; private string? _food; + private string? _files; public bool IsSelected { @@ -44,5 +45,11 @@ public string? Food get => _food; set => SetProperty(ref _food, value); } + + public string? Files + { + get => _files; + set => SetProperty(ref _files, value); + } } } \ No newline at end of file diff --git a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml index 8bef774cc2..91e9c74cc2 100644 --- a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml +++ b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml @@ -1347,6 +1347,14 @@ + + + + + + + + diff --git a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml index 0a320ed593..0d2a9aa685 100644 --- a/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml +++ b/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.DataGrid.ComboBox.xaml @@ -413,6 +413,14 @@ + + + + + + + +