-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ComboBox has Virtualizing disabled #1132
Comments
@xxMUROxx i used this to enable virtualization (without grouping, because it breaks the virtualization in .net 4, don't know if it works in .net 4.5) <Style TargetType="{x:Type ComboBox}"
BasedOn="{StaticResource MetroComboBox}">
<Setter Property="ScrollViewer.CanContentScroll"
Value="True" />
<Setter Property="ItemsPanel">
<Setter.Value>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsItemsHost="True"
KeyboardNavigation.DirectionalNavigation="Contained"
VirtualizationMode="Recycling" />
</ItemsPanelTemplate>
</Setter.Value>
</Setter>
</Style> |
Thanks @punker76 , this works. |
@xxMUROxx that's a .net <= 4 problem, in 4.5 it's better http://msdn.microsoft.com/en-us/library/bb613588(v=vs.110).aspx#grouped_virtualization |
@xxMUROxx here is the magic for MahApps public static void SetEnableVirtualizationWithGrouping(DependencyObject obj, bool value)
{
if (obj is ComboBox)
{
#if NET4_5
ComboBox comboBox = obj as ComboBox;
comboBox.SetValue(EnableVirtualizationWithGroupingProperty, value);
comboBox.SetValue(VirtualizingPanel.IsVirtualizingProperty, value);
comboBox.SetValue(VirtualizingPanel.IsVirtualizingWhenGroupingProperty, value);
#else
obj.SetValue(EnableVirtualizationWithGroupingProperty, false);
#endif
}
} |
Thanks for the XAML style, but it is not really working when using grouping and .NET4.5. Then the first opening of the ComboBox is slow. |
@xxMUROxx i'll take a look into later... |
I had to add your code, else it was unbareable slow.
|
You can use the VirtualisedMetroComboBox style
|
Virtualizing is not working with __ComboBox__es when loading long list of data.
After loading the data the ComboBox takes very long time to open, because virtualization is disabled.
A solution is to replace the
<ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" />
with VirtualizingStackPanel but then the grouping does not work anymore.
How do I enable Virtualization in ComboBoxes?
The text was updated successfully, but these errors were encountered: