public void AddActivityToInnerCanvas(UserControl activity, MouseEventArgs mouse) { Point posAtCanvas = mouse.GetPosition(ForLoopInnerCanvas); activity.SetValue(Canvas.TopProperty, posAtCanvas.Y); activity.SetValue(Canvas.LeftProperty, posAtCanvas.X); ForLoopInnerCanvas.Children.Add(activity); _nestedActivities.Add(activity as IActivityComponent); }
private void ControlMouseDown(object sender, MouseButtonEventArgs e) { if (sender.GetType().IsSubclassOf(typeof(UserControl))) { cardDragging = true; canvasDragging = false; CanvasScroll.PanningMode = PanningMode.None; uc = (UserControl)sender; uc.SetValue(Canvas.ZIndexProperty, count++); // Slutty :D } //else if (sender.GetType() == typeof(Canvas) && cardDragging != true) //{ // cardDragging = false; // canvasDragging = true; // startMousePos = e.GetPosition(null); //} }
public void SetScriptView(object viewAsObject) { if (object.ReferenceEquals(_scriptView, viewAsObject)) return; if (null != _scriptView) { this._mainGrid.Children.Remove(_scriptView); } _scriptView = (UserControl)viewAsObject; if (null != _scriptView) { _scriptView.SetValue(Grid.ColumnProperty, 0); _scriptView.SetValue(Grid.ColumnSpanProperty, 5); _scriptView.SetValue(Grid.RowProperty, 3); this._mainGrid.Children.Add(_scriptView); } }
internal void AssociateWidget(Widget widget, UserControl userControl) { int widgetIndex = ((int)widget); if (null == widgets[widgetIndex]) { widgets[widgetIndex] = userControl; // GRIDLAYOUTSPECIFIC: Revise this logic if grid changes. userControl.SetValue(Grid.RowProperty, 5); if (mainEditorGrid.Children.Add(userControl) != -1) { if (userControl.Visibility != System.Windows.Visibility.Visible) userControl.Visibility = System.Windows.Visibility.Visible; mainEditorGrid.UpdateLayout(); } // Display the button corresponding to the widget. toggleButtons[widgetIndex].Visibility = Visibility.Visible; } // Toggle the corresponding button first... for (int index = 0; index < toggleButtons.Length; ++index) { bool isChecked = (index == ((int)widget)); toggleButtons[index].IsChecked = isChecked; } // Start the transition to show the widgets. BringWidgetToForeground(widget); DisplayWidgets(true); }
/// <summary> /// Sets the view model instance attached to the specified control. /// The view model is also used as the DataContext assigned to the control. /// </summary> /// <param name="userControl">The control to associated the view model with.</param> /// <param name="value">The view model instance.</param> public static void SetViewModel(UserControl userControl, object value) { userControl.SetValue(ViewModelProperty, value); userControl.DataContext = value; }
/// <summary> /// Sets the view model instance attached to the specified control. /// The view model is also used as the DataContext assigned to the control. /// </summary> /// <param name="userControl">The control to associated the view model with.</param> /// <param name="value">The view model instance.</param> public static void SetViewModel(UserControl userControl, object value) { userControl.SetValue(ModelProperty, value); }
public static void SetDialogResult(UserControl target, bool? value) { target.SetValue(DialogResultProperty, value); }