Merged in miniob_deselect (pull request #272)

fixing unselect all
This commit is contained in:
Jake Norbut authored and Pedro Pinto committed 2019-06-19 20:20:50 +00:00
commit c899904f3a
3 files changed
+13 -7

No files matched your search

@@ -347,7 +347,7 @@ namespace mbts.spark {
public event Action<OrderRecordImmutable?> selected_order_changed;
public event Action begin_attaching, end_attaching;
public event Action<IEnumerable> request_selection;
public event Action<(IEnumerable, bool)> request_selection;
public ObservableAppendCollection<DIYGrid.ColumnBase> columns { get; }
public ObservableCollection<DIYGrid.ColumnBase> core_columns => _columns;
@@ -437,7 +437,7 @@ namespace mbts.spark {
get => _all_rows_selected;
set {
Set(ref _all_rows_selected, value);
request_selection?.Invoke(_row_collection);
request_selection?.Invoke((_row_collection, _all_rows_selected));
}
}
@@ -162,6 +162,10 @@ namespace mbts.ui.controls {
base.SetSelectedItems(items);
}
public new void UnselectAll() {
base.UnselectAll();
}
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) {
var pt = e.GetPosition(this);
var container = this.ChildAtPoint<ListBoxItem>(pt);
@@ -904,8 +908,12 @@ namespace mbts.ui.controls {
if (selection_request_handler != null && owner._row_presenter is DIYGridRowsPresenter diy_rp) {
selection_request_handler.request_selection += selection_requested;
_hooks.Add(Disposable.Create(() => selection_request_handler.request_selection -= selection_requested));
void selection_requested(IEnumerable items) {
diy_rp.SetSelectedItems(items);
void selection_requested((IEnumerable items, bool is_selected) items_and_selectionstate) {
if (items_and_selectionstate.is_selected) {
diy_rp.SetSelectedItems(items_and_selectionstate.items);
} else {
diy_rp.UnselectAll();
}
}
}
}
@@ -7,8 +7,6 @@ using System.Threading.Tasks;
namespace mbts.ui.controls {
interface IRequestRowSelection {
event Action<IEnumerable> request_selection;
event Action<(IEnumerable, bool)> request_selection;
}
}