private void OnShapeChanged(object sender, ShapeChangedArgs e) { switch (e.action) { case ShapeChangedArgs.Action.Removed: if (SelectedObject == e.shape) { SelectedObject = null; } break; case ShapeChangedArgs.Action.RefreshProperties: case ShapeChangedArgs.Action.NameChanged: if (SelectedObject == e.shape) { InvalidatePropertyGrid(); this.ReadOnly = !e.shape.Modifiable; } break; case ShapeChangedArgs.Action.Clicked: if (!(SelectedObject is ShapeBase)) { // The user selects a shape while the property grid still shows an item // from a different panel (e.g. layer). This typically means that the user // clicked in the shape tree while another panel was active. We might not // get a SelectionChanged event in this case (due to the focus change) and // thus manually update the property grid selection now. SelectedObjects = EditorManager.SelectedShapes.ToArray(); } break; } }
void ShapeChanged(object sender, ShapeChangedArgs e) { if (e.action == ShapeChangedArgs.Action.Removed && e.shape == _shape) { // Will result in call to OnDeactivate and end the editing EditorManager.ActiveView.SetDefaultContext(); } }
private void OnShapeChanged(object sender, ShapeChangedArgs e) { switch (e.action) { case ShapeChangedArgs.Action.Removed: if (SelectedObject==e.shape) SelectedObject = null; break; case ShapeChangedArgs.Action.RefreshProperties: case ShapeChangedArgs.Action.NameChanged: if (SelectedObject == e.shape) { InvalidatePropertyGrid(); this.ReadOnly = !e.shape.Modifiable; } break; case ShapeChangedArgs.Action.Clicked: if (!(SelectedObject is ShapeBase)) { // The user selects a shape while the property grid still shows an item // from a different panel (e.g. layer). This typically means that the user // clicked in the shape tree while another panel was active. We might not // get a SelectionChanged event in this case (due to the focus change) and // thus manually update the property grid selection now. SelectedObjects = EditorManager.SelectedShapes.ToArray(); } break; } }