internal AnnoCreatedEventArgs(Windows.UI.Xaml.Controls.Canvas canvas, UIElement label, int index, double value) { Canvas = canvas; Label = label; Index = index; Value = value; }
internal VNode(Node node, FrameworkElement frameworkElementOfNodeForLabelOfLabel, Func <Edge, VEdge> funcFromDrawingEdgeToVEdge, Func <double> pathStrokeThicknessFunc) { PathStrokeThicknessFunc = pathStrokeThicknessFunc; Node = node; FrameworkElementOfNodeForLabel = frameworkElementOfNodeForLabelOfLabel; _funcFromDrawingEdgeToVEdge = funcFromDrawingEdgeToVEdge; CreateNodeBoundaryPath(); if (FrameworkElementOfNodeForLabel != null) { FrameworkElementOfNodeForLabel.Tag = this; //get a backpointer to the VNode Common.PositionFrameworkElement(FrameworkElementOfNodeForLabel, node.GeometryNode.Center, 1); Panel.SetZIndex(FrameworkElementOfNodeForLabel, Panel.GetZIndex(BoundaryPath) + 1); } SetupSubgraphDrawing(); Node.Attr.VisualsChanged += (a, b) => Invalidate(); Node.IsVisibleChanged += obj => { foreach (var frameworkElement in FrameworkElements) { frameworkElement.Opacity = Node.IsVisible ? 1 : 0; } }; }
public ManipulationManager(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas parent) : base(element, parent) { this._handlersRegistered = false; this.InitialTransform = this._target.RenderTransform; this.ResetManipulation(); }
internal void CreateNodeBoundaryPath() { if (FrameworkElementOfNodeForLabel != null) { var center = Node.GeometryNode.Center; var margin = 2 * Node.Attr.LabelMargin; var bc = NodeBoundaryCurves.GetNodeBoundaryCurve(Node, FrameworkElementOfNodeForLabel .Width + margin, FrameworkElementOfNodeForLabel .Height + margin); bc.Translate(center); } BoundaryPath = new Path { Data = CreatePathFromNodeBoundary(), Tag = this }; Panel.SetZIndex(BoundaryPath, ZIndex); SetFillAndStroke(); if (Node.Label != null) { ToolTipService.SetToolTip(BoundaryPath, Node.LabelText); if (FrameworkElementOfNodeForLabel != null) { ToolTipService.SetToolTip(FrameworkElementOfNodeForLabel, Node.LabelText); } } }
void SetupCollapseSymbol() { var collapseBorderSize = GetCollapseBorderSymbolSize(); Debug.Assert(collapseBorderSize > 0); _collapseButtonBorder = new Border { Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive), Width = collapseBorderSize, Height = collapseBorderSize, CornerRadius = new CornerRadius(collapseBorderSize / 2) }; Panel.SetZIndex(_collapseButtonBorder, Panel.GetZIndex(BoundaryPath) + 1); var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize); Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1); double w = collapseBorderSize * 0.4; _collapseSymbolPath = new Path { Data = CreateCollapseSymbolPath(collapseButtonCenter + new Point(0, -w / 2), w), Stroke = _collapseSymbolPathInactive, StrokeThickness = 1 }; Panel.SetZIndex(_collapseSymbolPath, Panel.GetZIndex(_collapseButtonBorder) + 1); _topMarginRect.PointerPressed += (s, e) => TopMarginRectMouseLeftButtonDown(e); }
internal void DetouchFromCanvas(Canvas graphCanvas) { if (BoundaryPath != null) { graphCanvas.Children.Remove(BoundaryPath); } if (FrameworkElementOfNodeForLabel != null) { graphCanvas.Children.Remove(FrameworkElementOfNodeForLabel); } }
internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference) { this._target = element; this._reference = reference; // Setup pointer event handlers for the element. this._target.PointerCanceled += OnPointerCanceled; this._target.PointerMoved += OnPointerMoved; this._target.PointerPressed += OnPointerPressed; this._target.PointerReleased += OnPointerReleased; this._target.PointerWheelChanged += OnPointerWheelChanged; // Create the gesture recognizer this._gestureRecognizer = new Windows.UI.Input.GestureRecognizer(); this._gestureRecognizer.GestureSettings = Windows.UI.Input.GestureSettings.None; }
void SetZIndexAndMouseInteractionsForTopMarginRect() { _topMarginRect.PointerEntered += (a, b) => { _collapseButtonBorder.Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorActive); _collapseSymbolPath.Stroke = new SolidColorBrush(Colors.Black); }; _topMarginRect.PointerReleased += (a, b) => { _collapseButtonBorder.Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive); _collapseSymbolPath.Stroke = new SolidColorBrush(Colors.Silver); }; Panel.SetZIndex(_topMarginRect, int.MaxValue); }
/// <summary> /// Constructor. /// </summary> /// <param name="element"> /// Manipulation target. /// </param> /// <param name="reference"> /// Element that contains the coordinate space used for expressing transformations /// during manipulations, usually the parent element of Target in the UI tree. /// </param> /// <remarks> /// Transformations during manipulations cannot be expressed in the coordinate space of the manipulation target. /// Thus <paramref name="element"/> and <paramref name="reference"/> must be different. Usually <paramref name="reference"/> /// will be an ancestor of <paramref name="element"/> in the UI tree. /// </remarks> internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference) { this._target = element; this._reference = reference; // Setup pointer event handlers for the element. // They are used to feed the gesture recognizer. this._target.PointerCanceled += OnPointerCanceled; this._target.PointerMoved += OnPointerMoved; this._target.PointerPressed += OnPointerPressed; this._target.PointerReleased += OnPointerReleased; this._target.PointerWheelChanged += OnPointerWheelChanged; // Create the gesture recognizer this._gestureRecognizer = new Windows.UI.Input.GestureRecognizer(); this._gestureRecognizer.GestureSettings = Windows.UI.Input.GestureSettings.None; }
/// <summary> /// Constructor. /// </summary> /// <param name="element"> /// Manipulation target. /// </param> /// <param name="reference"> /// Element that contains the coordinate space used for expressing transformations /// during manipulations, usually the parent element of Target in the UI tree. /// </param> /// <remarks> /// Transformations during manipulations cannot be expressed in the coordinate space of the manipulation target. /// Thus <paramref name="element"/> and <paramref name="reference"/> must be different. Usually <paramref name="reference"/> /// will be an ancestor of <paramref name="element"/> in the UI tree. /// </remarks> internal InputProcessor(Windows.UI.Xaml.FrameworkElement element, Windows.UI.Xaml.Controls.Canvas reference) { _target = element; _reference = reference; // Setup pointer event handlers for the element. // They are used to feed the gesture recognizer. _target.PointerMoved += OnPointerMoved; _target.PointerPressed += OnPointerPressed; _target.PointerReleased += OnPointerReleased; _target.PointerCanceled += OnPointerCanceled; _target.PointerWheelChanged += OnPointerWheelChanged; CrossSlideThresholds cst = new CrossSlideThresholds(); //cst.RearrangeStart = 10;//cst.SelectionStart = 12; //cst.SpeedBumpStart = 12;//cst.SpeedBumpEnd = 24; // Create the gesture recognizer _gestureRecognizer = new GestureRecognizer(); _gestureRecognizer.GestureSettings = GestureSettings.Hold | GestureSettings.ManipulationRotate | GestureSettings.ManipulationRotateInertia | GestureSettings.ManipulationScale | GestureSettings.ManipulationScaleInertia | GestureSettings.ManipulationTranslateInertia | GestureSettings.ManipulationTranslateX | GestureSettings.ManipulationTranslateY | GestureSettings.RightTap | GestureSettings.Tap | GestureSettings.CrossSlide; _gestureRecognizer.CrossSlideHorizontally = true; _gestureRecognizer.CrossSlideThresholds = cst; _gestureRecognizer.ManipulationStarted += OnManipulationStarted; _gestureRecognizer.ManipulationUpdated += OnManipulationUpdated; _gestureRecognizer.ManipulationInertiaStarting += OnManipulationInertiaStarting; _gestureRecognizer.ManipulationCompleted += OnManipulationCompleted; _gestureRecognizer.Dragging += OnDragging; _gestureRecognizer.Holding += OnHolding; _gestureRecognizer.RightTapped += OnRightTapped; _gestureRecognizer.Tapped += OnTapped; _gestureRecognizer.CrossSliding += OnCrossSliding; }
private void WindowsXamlHost_Loaded(object sender, RoutedEventArgs e) { Windows.UI.Xaml.Controls.StackPanel stackPanel = new Windows.UI.Xaml.Controls.StackPanel() { Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Black), }; stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle() { Width = 50, Height = 75, Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Blue), }); stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle() { Width = 200, Height = 30, Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Red), }); var button = new Windows.UI.Xaml.Controls.Button() { Width = 160, Height = 60, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Content = "ContentDialog UWP Button", }; button.Tapped += Button_Tapped; stackPanel.Children.Add(button); stackPanel.Children.Add(new Windows.UI.Xaml.Shapes.Rectangle() { Width = 25, Height = 100, Fill = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green), }); Windows.UI.Xaml.Controls.Flyout flyout = new Windows.UI.Xaml.Controls.Flyout(); flyout.Content = new Windows.UI.Xaml.Controls.TextBlock() { Text = "Flyout content", }; var button2 = new Windows.UI.Xaml.Controls.Button() { Width = 300, Height = 40, HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, Content = "Long UWP Button with Flyout", Flyout = flyout, }; stackPanel.Children.Add(button2); var comboBox = new Windows.UI.Xaml.Controls.ComboBox() { HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center, }; comboBox.Items.Add("One"); comboBox.Items.Add("Two"); comboBox.Items.Add("Three"); comboBox.Items.Add("Four"); stackPanel.Children.Add(comboBox); Windows.UI.Xaml.Controls.Grid grid = new Windows.UI.Xaml.Controls.Grid(); stackPanel.Children.Add(grid); _contentDialog = new Windows.UI.Xaml.Controls.ContentDialog(); _contentDialog.Content = new Windows.UI.Xaml.Controls.TextBlock() { Text = "ContentDialog content", }; stackPanel.Children.Add(_contentDialog); var popup = new Windows.UI.Xaml.Controls.Primitives.Popup() { Width = 50, Height = 50, }; grid.Children.Add(popup); var canvas = new Windows.UI.Xaml.Controls.Canvas() { Width = 50, Height = 50, Background = new Windows.UI.Xaml.Media.SolidColorBrush(Windows.UI.Colors.Green), }; popup.Child = canvas; windowsXamlHost.Child = stackPanel; popup.IsOpen = true; }
public InkCanvas2(Windows.UI.Xaml.Controls.Canvas canvas) { }
public WpfCanvas() { _canvas = new Windows.UI.Xaml.Controls.Canvas(); _currentPath = CreateNewPath(); }
public void BeginRender(float width, float height) { _canvas = new Windows.UI.Xaml.Controls.Canvas(); _canvas.Width = width; _canvas.Height = height; }