private void ObjectRow_CheckChanged(UCEObjectRow row) { if (row.Checked) { //set obj's position to selected one MapObject mo = (MapObject)row.Tag; mo.Position = mapEditor.SelectedPositions.FirstOrDefault(); } else { //set obj's position to null MapObject mo = (MapObject)row.Tag; mo.Position = null; } mapEditor.Redraw(); }
private void RefreshMapObjectsPanel() { spObjects.Children.Clear(); if (mapEditor.SelectedPositions.Count != 1) { return; } var selectedPos = mapEditor.SelectedPositions.FirstOrDefault(); foreach (var obj in Config.Map.Objects) { UCEObjectRow objectRow = new UCEObjectRow(obj, obj.Position != null && obj.Position.Equals(selectedPos)); objectRow.CheckChanged += ObjectRow_CheckChanged; spObjects.Children.Add(objectRow); } }