private object convert(object value, Type targetType, object parameter, CultureInfo culture) { string shape = value as string; // Convert invalid shapeID into invalid snap target if (shape == null || shape == string.Empty || this.ReferenceControl == null) { return(null); } // Find canvas view through reference on this converter CanvasView cv = CanvasView.GetCanvasView(this.ReferenceControl); // No canvas view found if (cv == null) { return(null); } // Get references element from viewmodel ShapeViewModelBase e = cv.CanvasViewModel.DocumentViewModel.dm_DocumentDataModel.GetShapeById(shape); // Use CanvasView to find canvas object in vicinity return(cv.ControlFromElement(e)); }
private object convert(object value, Type targetType, object parameter, CultureInfo culture) { String shape = value as String; if (shape == null || shape == "" || ReferenceControl == null) { return(null); } CanvasView cv = CanvasView.GetCanvasView(ReferenceControl); if (cv == null) { return(null); } return(cv.ControlFromElement(cv._CanvasViewModel._DocumentViewModel.dm_DocumentDataModel.GetShapeById(shape))); }