internal VNode(MNode node, WFrameworkElement frameworkElementOfNodeForLabelOfLabel, Func <MEdge, 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); WPanel.SetZIndex(FrameworkElementOfNodeForLabel, WPanel.GetZIndex(BoundaryPath) + 1); } SetupSubgraphDrawing(); Node.Attr.VisualsChanged += (a, b) => Invalidate(); Node.IsVisibleChanged += obj => { foreach (var frameworkElement in FrameworkElements) { frameworkElement.Visibility = Node.IsVisible ? WVisibility.Visible : WVisibility.Hidden; } }; }
void SetupCollapseSymbol() { var collapseBorderSize = GetCollapseBorderSymbolSize(); Debug.Assert(collapseBorderSize > 0); _collapseButtonBorder = new WBorder { Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive), Width = collapseBorderSize, Height = collapseBorderSize, CornerRadius = new WCornerRadius(collapseBorderSize / 2) }; WPanel.SetZIndex(_collapseButtonBorder, WPanel.GetZIndex(BoundaryPath) + 1); var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize); Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1); double w = collapseBorderSize * 0.4; _collapseSymbolPath = new WPath { Data = CreateCollapseSymbolPath(collapseButtonCenter + new MPoint(0, -w / 2), w), Stroke = _collapseSymbolPathInactive, StrokeThickness = 1 }; WPanel.SetZIndex(_collapseSymbolPath, WPanel.GetZIndex(_collapseButtonBorder) + 1); _topMarginRect.MouseLeftButtonDown += TopMarginRectMouseLeftButtonDown; }
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 WPath { Data = CreatePathFromNodeBoundary(), Tag = this }; WPanel.SetZIndex(BoundaryPath, ZIndex); SetFillAndStroke(); if (Node.Label != null) { BoundaryPath.ToolTip = Node.LabelText; if (FrameworkElementOfNodeForLabel != null) { FrameworkElementOfNodeForLabel.ToolTip = Node.LabelText; } } }
private void MiniPlayer_OnKeyUp(object sender, KeyEventArgs e) { if (e.Key != Key.LeftShift) { return; } Panel.SetZIndex(BgProgressBar, -1); AllowDrag = true; _positionToolTip.IsOpen = false; BgProgressBar.ToolTip = null; }
private void InitChart() { Brush chartBack = new SolidColorBrush(Color.FromRgb(200, 80, 45)); Chart.Background = chartBack; Chart.DataTooltip = null; Chart.Hoverable = false; Chart.AxisX.Clear(); Axis axis = new Axis { Title = "X", Labels = Enumerable.Range(_firstPoint, _pointCount) .Select(d => ((double)d / (double)_pointScale).ToString()) .ToList(), Separator = new Separator { Visibility = Visibility.Collapsed } }; Chart.AxisX.Add(axis); LineSeries s1 = new LineSeries { Title = "Function", Values = new ChartValues <ObservableValue>(), PointGeometry = null, Fill = new SolidColorBrush(Color.FromRgb(158, 45, 200)), StrokeThickness = 0, }; LineSeries s2 = new LineSeries { Values = new ChartValues <ObservableValue>(), PointGeometry = null, Fill = chartBack, StrokeThickness = 0 }; Panel.SetZIndex(s1, -2); Panel.SetZIndex(s2, -1); Chart.Series = new SeriesCollection { s1, s2, }; for (int i = 0; i < _pointCount; i++) { Chart.Series[0].Values.Add(new ObservableValue(0)); Chart.Series[1].Values.Add(new ObservableValue(0)); } UpdateChart(); }
private void MiniPlayer_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.LeftShift || !IsVisible) { return; } Panel.SetZIndex(BgProgressBar, 1); AllowDrag = false; _positionToolTip.Content = PositionToolTipText; BgProgressBar.ToolTip = _positionToolTip; var p = MouseUtils.CorrectGetPosition(); _positionToolTip.HorizontalOffset = p.X; _positionToolTip.VerticalOffset = p.Y - 20; if (BgProgressBar.IsMouseOver) { _positionToolTip.IsOpen = true; } }
void SetZIndexAndMouseInteractionsForTopMarginRect() { _topMarginRect.MouseEnter += ( (a, b) => { _collapseButtonBorder.Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorActive); _collapseSymbolPath.Stroke = WBrushes.Black; } ); _topMarginRect.MouseLeave += (a, b) => { _collapseButtonBorder.Background = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive); _collapseSymbolPath.Stroke = WBrushes.Silver; }; WPanel.SetZIndex(_topMarginRect, int.MaxValue); }
public StackedForm() { InitializeComponent(); cartesianChart1.DisableAnimations = true; cartesianChart1.Pan = PanningOptions.X; cartesianChart1.Series.Add(new GLineSeries { Values = _vm.Values1, StrokeThickness = 0, AreaLimit = 0, PointGeometry = null }); cartesianChart1.Series.Add(new GLineSeries { Values = _vm.Values2, StrokeThickness = 0, AreaLimit = 0, PointGeometry = null }); cartesianChart1.Series.Add(new GLineSeries { Values = _vm.Values3, StrokeThickness = 0, AreaLimit = 0, PointGeometry = null }); //z index order Panel.SetZIndex((FrameworkElement)cartesianChart1.Series[0], 3); Panel.SetZIndex((FrameworkElement)cartesianChart1.Series[1], 2); Panel.SetZIndex((FrameworkElement)cartesianChart1.Series[2], 1); cartesianChart1.AxisX.Add(new Axis { LabelFormatter = _vm.XFormatter, Separator = new Separator { Step = _vm.Step, IsEnabled = false } }); cartesianChart1.AxisY.Add(new Axis { MinValue = -1, MaxValue = 1, LabelFormatter = _vm.YFormatter, Separator = new Separator { Stroke = new SolidColorBrush(Color.FromRgb(235, 235, 235)) } }); scrollerchart.DisableAnimations = true; scrollerchart.ScrollMode = ScrollMode.X; scrollerchart.ScrollBarFill = new SolidColorBrush(Color.FromArgb(25, 30, 30, 30)); scrollerchart.DataTooltip = null; scrollerchart.Hoverable = false; scrollerchart.Series.Add(new GLineSeries { Values = _vm.Values3, Fill = new SolidColorBrush(Color.FromRgb(215, 67, 21)), AreaLimit = 0, PointGeometry = null }); scrollerchart.AxisX.Add(new Axis { ShowLabels = false, Separator = new Separator { IsEnabled = false } }); scrollerchart.AxisY.Add(new Axis { MinValue = -1, MaxValue = 1, Separator = new Separator { Stroke = new SolidColorBrush(Color.FromRgb(235, 235, 235)) } }); //lets bind the charts //the assistant synchronizes both charts //here he are setting the initial range _assistant = new BindingAssistant { From = _vm.From, To = _vm.To }; cartesianChart1.AxisX[0].SetBinding(Axis.MinValueProperty, new System.Windows.Data.Binding { Path = new PropertyPath("From"), Source = _assistant, Mode = BindingMode.TwoWay }); cartesianChart1.AxisX[0].SetBinding(Axis.MaxValueProperty, new System.Windows.Data.Binding { Path = new PropertyPath("To"), Source = _assistant, Mode = BindingMode.TwoWay }); scrollerchart.Base.SetBinding(CartesianChart.ScrollHorizontalFromProperty, new System.Windows.Data.Binding { Path = new PropertyPath("From"), Source = _assistant, Mode = BindingMode.TwoWay }); scrollerchart.Base.SetBinding(CartesianChart.ScrollHorizontalToProperty, new Binding { Path = new PropertyPath("To"), Source = _assistant, Mode = BindingMode.TwoWay }); }