protected LevelGridButton AddItem(LevelGridItem item) { LevelGridButton button = new LevelGridButton() { DataContext = item }; _buttons.Add(button); button.Delete += OnItemDelete; button.Edit += OnItemEdit; ButtonGrid.Children.Add(button); return button; }
protected void SetGrid(LevelGridButton button, LevelGridItem item) { Grid.SetRow(button, item.YCord); Grid.SetColumn(button, item.XCord); Grid.SetRowSpan(button, item.GridHeight); Grid.SetColumnSpan(button, item.GridWidth); }
protected void OnItemEdit(LevelGridItem button) { if (ItemEdit != null) ItemEdit(button as LevelGridItem); }
protected void OnItemDelete(LevelGridItem button) { if (ItemDelete != null) ItemDelete(button as LevelGridItem); }
protected void DeleteItem(LevelGridItem item) { LevelGridButton button = _buttons.Find(x => x.DataContext == item); ButtonGrid.Children.Remove(button); _buttons.Remove(button); }
protected void SetModel(object sender, DependencyPropertyChangedEventArgs e) { _model = DataContext as LevelGridItem; Initialise(); }