private void move_subitem_down_MouseDown(object sender, MouseButtonEventArgs e) { try { Application.Current.Dispatcher.Invoke(new Action(() => { Image b = sender as Image; Model.Subitems subitems = b.DataContext as Model.Subitems; if (subitems != null) { list_subitems.SelectedItem = mSubitems; var selectedIndex = list_subitems.SelectedIndex; if (selectedIndex + 1 < mSubitems.Count) { var itemToMoveDown = this.mSubitems[selectedIndex]; this.mSubitems.RemoveAt(selectedIndex); this.mSubitems.Insert(selectedIndex + 1, itemToMoveDown); this.list_subitems.SelectedIndex = selectedIndex + 1; } } })); } catch (Exception ex) { } }
private void image_delete_subitem_MouseDown(object sender, MouseButtonEventArgs e) { try { Application.Current.Dispatcher.Invoke(new Action(() => { Image b = sender as Image; Model.Subitems subitems = b.DataContext as Model.Subitems; if (subitems != null) { mSubitems.RemoveAt(subitems._Index); for (int i = 0; i < mSubitems.Count; i++) { mSubitems[i]._Index = i; } } })); } catch (Exception ex) { } }
private bool subItemsFilter(Model.Subitems model) { return(model._IdItem == IdItem); }