Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
470
performance issues
posted

Hi,

I derived my SelectAllComboEditor from your XamComboEditor to provide a "SelectAll" button in a ContextMenu to my users.

Unfortunately, the operation takes about 20 sec for 100 entries and about 3 min for 1000 entries.

How can I speed this up?

using System.Windows.Controls;
using System.Windows.Input;
using Infragistics.Controls.Editors;
using Microsoft.Practices.ObjectBuilder2;
using Workbench.Core.UI.Commands;

public class SelectAllComboEditor : XamComboEditor
{
protected override void OnMouseRightButtonDown(MouseButtonEventArgs e)
{
ContextMenu contextMenu = new ContextMenu();

MenuItem selectAll = new MenuItem
{
Header = "Select All",
Command = SelectAllCommand
};

contextMenu.Items.Add(selectAll);
contextMenu.Items.Add(deselectAll);

contextMenu.IsOpen = true;
}

public ICommand SelectAllCommand
{
get
{
return new RelayCommand((_) =>
{
SelectAll();
});
}
}

private void SelectAll()
{

//slow operation
Items.ForEach(x => x.IsSelected = true);
}

}

<utils:SelectAllComboEditor Grid.Column="4"
Grid.Row="1"
Margin="0,0,10,0"
AllowMultipleSelection="True"
CheckBoxVisibility="Visible"
ItemsSource="{Binding Path=ErrorParameters}"
DisplayMemberPath="Name"
IsSelectedMemberPath="IsSelected"
IsEditable="False"/>

Best

Oliver