private void OnGraphControlConnectionDragStarted(object sender, ConnectionDragStartedEventArgs e) { elementsCanvas ??= graphControl.FindDescendantOfType <Canvas>(); var sourceConnector = (ConnectorViewModel <QuestViewModel, QuestConnectionViewModel>)e.SourceConnector.DataContext !; var currentDragPoint = e.GetPosition(elementsCanvas); var connection = ViewModel.OnConnectionDragStarted(sourceConnector, currentDragPoint); e.Connection = connection; }
private void InitializeComponent() { AvaloniaXamlLoader.Load(this); graphControl = this.FindControl <GraphControl>("GraphControl"); elementsCanvas = graphControl.FindDescendantOfType <Canvas>(); }