private static void OnPreviewKeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Space)
                return;

            e.Handled = true;
            var listView = (ListView)sender;
            var command = (RelayCommand<SelectWorkItemsCommandArgument>)listView.GetValue(CommandProperty);

            var selectedItems = listView.SelectedItems.Cast<WorkItemModel>().ToArray();

            var workItemModel =
                selectedItems.Any()
                && (!selectedItems.Last().IsSelected);

            var selectWorkItemsCommandArgument = new SelectWorkItemsCommandArgument
                {
                    Collection = selectedItems, Value = workItemModel
                };

            command.Execute(selectWorkItemsCommandArgument);
        }
        private void SelectWorkItems(SelectWorkItemsCommandArgument selectWorkItemsCommandArgument)
        {
            this.Logger().Debug("Select Work Items: {0}, Count: {1}", selectWorkItemsCommandArgument.Value, selectWorkItemsCommandArgument.Collection.Count());

            _backgroundFunctionPreventDataUpdate = true;

            foreach (var workItemModel in selectWorkItemsCommandArgument.Collection)
            {
                workItemModel.IsSelected = selectWorkItemsCommandArgument.Value;
            }

            _backgroundFunctionPreventDataUpdate = false;
        }
 private bool CanSelectWorkItems(SelectWorkItemsCommandArgument commandArgument)
 {
     return commandArgument.Collection != null && commandArgument.Collection.Any();
 }