/// <summary> /// Called when an item is dropped on the <see cref="ListView"/> of Successors. /// </summary> private async void SuccessorsListBox_OnDrop(object sender, DragEventArgs e) { BusinessData currentData = GetCurrentItemData(); if (currentData != null) { await OnDropOnListBox(e, currentData.Successors); } }
private static void StartDrag([NotNull] BusinessData data, FrameworkElement o, ListType listType) { // initialize the drag operation of a business data object if (o != null) { DataObject dao = new DataObject(); dao.SetData(typeof(BusinessData), data); dao.SetData(typeof(ListType), listType); DragDrop.DoDragDrop(o, dao, DragDropEffects.Link | DragDropEffects.Copy | DragDropEffects.Move); } }
public object Clone() { BusinessData clone = new BusinessData(NodeName); foreach (var successor in Successors) { clone.Successors.Add(successor); } foreach (var predecessor in Predecessors) { clone.Predecessors.Add(predecessor); } return(clone); }
private void TemplateNode_OnMouseUp(object sender, MouseButtonEventArgs e) { // get data from control BusinessData data = templateNodeControl.Content as BusinessData; if (data != null) { // show textbox templateNodeTextBox.Text = data.NodeName; templateNodeTextBox.Visibility = Visibility.Visible; templateNodeTextBox.Focus(); templateNodeTextBox.SelectAll(); } }
private async void AddData(ICollection <BusinessData> collection, ExecutedRoutedEventArgs e) { var command = e.Command as RoutedUICommand; var dialog = new StringInputDialog { Title = command == null ? "New Data" : command.Text, Label = "Name" }; if (dialog.ShowDialog() == true) { var data = new BusinessData(dialog.Value); collection.Add(data); await ApplyLayout(true, data); } }