/// <summary> 刷新ToolTip </summary> public void Refresh() { this._items.Clear(); this.stackPanel.Children.Clear(); foreach (var item in _curve.DataSource) { if (item.Visibility != Visibility.Visible) { continue; } LineLegendDetail con = new LineLegendDetail(item); Style s = this.TryFindResource("DefaultLineLegendDetail") as Style; con.Style = s; this._items.Add(con); //this.content.Children.Add(item.Marker); this.stackPanel.Children.Add(con); } }
///// <summary> 绑定到指定曲线图中 </summary> //public static void BindingInTo(CurveChartPlotter c) //{ // CursorGraphLine cursorgraphline = new CursorGraphLine(); // cursorgraphline._curve = c; // cursorgraphline.SetParent(c.ParallelCanvas); //} public void SetParent(Canvas c) { this.content.Width = c.ActualWidth; this.content.Height = c.ActualHeight; c.MouseMove += parent_MouseMove; c.MouseEnter += Parent_MouseEnter; c.MouseLeave += Parent_MouseLeave; // Todo :增加蒙版用于响应事件 Rectangle r1 = new Rectangle(); r1.Width = c.ActualWidth; r1.Height = c.ActualHeight; r1.Fill = Brushes.Transparent; Canvas.SetTop(r1, 0); c.Children.Add(r1); c.Children.Add(this); foreach (var item in _curve.DataSource) { if (item.Visibility != Visibility.Visible) { continue; } LineLegendDetail con = new LineLegendDetail(item); Style s = this.TryFindResource("DefaultLineLegendDetail") as Style; con.Style = s; this._items.Add(con); if (item.Marker != null) { if (item.Marker.Parent != null) { this.content.Children.Add(item.Marker.Clone()); } else { this.content.Children.Add(item.Marker); } } this.stackPanel.Children.Add(con); } }