private void EnsureMoreSeriesIndicatorCreated() { if (_moreSeriesTop != null) { return; } _moreSeriesTop = new ChartPanelMoreIndicator { Margin = new Thickness(2), Content = "...", FontSize = _chartX.FontSize, Background = new SolidColorBrush(Colors.Yellow), Foreground = new SolidColorBrush( #if WPF Colors.Navy #elif SILVERLIGHT ColorsEx.Navy #endif ), Visible = false, Position = ChartPanelMoreIndicatorPosition.TopLeft, }; _moreSeriesTop.Click += MoreSeriesTopOnClick; _rootCanvas.Children.Add(_moreSeriesTop); _moreSeriesBottom = new ChartPanelMoreIndicator { Margin = new Thickness(2, -2, 0, 4), Content = "...", FontSize = _chartX.FontSize, Background = new SolidColorBrush(Colors.Yellow), Foreground = new SolidColorBrush( #if WPF Colors.Navy #elif SILVERLIGHT ColorsEx.Navy #endif ), Visible = false, Position = ChartPanelMoreIndicatorPosition.BottomLeft, }; _moreSeriesBottom.Click += MoreSeriesTopOnClick; _rootCanvas.Children.Add(_moreSeriesBottom); SetMoreIndicatorTemplate(); }
private void MoreSeriesTopOnClickOld(object sender, RoutedEventArgs routedEventArgs) { if (_morePanelPopup != null && _morePanelPopup.IsOpen) { _morePanelPopup.IsOpen = false; return; } ChartPanelMoreIndicator indicator = (ChartPanelMoreIndicator)sender; var list = indicator.Position == ChartPanelMoreIndicatorPosition.BottomLeft ? _notVisibleLineStudiesBelow : _notVisibleLineStudiesAbove; IChartPanelMoreIndicatorPanel panel = MoreIndicatorPanel ?? new ChartPanelMoreIndicatorPanel(); panel.Init(this, list.Where(_ => _.IsAlive).Select(_ => (LineStudies.LineStudy)_.Target), indicator.Position); if (_morePanelPopup == null) { _morePanelPopup = new Popup { #if WPF PopupAnimation = PopupAnimation.Slide, StaysOpen = false, #endif }; } _morePanelPopup.Child = panel.ElementToShow; #if WPF _morePanelPopup.PlacementTarget = indicator.Position == ChartPanelMoreIndicatorPosition.BottomLeft ? _moreSeriesBottom : _moreSeriesTop; _morePanelPopup.Placement = indicator.Position == ChartPanelMoreIndicatorPosition.BottomLeft ? PlacementMode.Top : PlacementMode.Bottom; _morePanelPopup.IsOpen = true; #elif SILVERLIGHT PopupSL p = new PopupSL(_morePanelPopup); p.PlacementTarget = indicator.Position == ChartPanelMoreIndicatorPosition.BottomLeft ? _moreSeriesBottom : _moreSeriesTop; p.Placement = indicator.Position == ChartPanelMoreIndicatorPosition.BottomLeft ? PlacementMode.Top : PlacementMode.Bottom; p.IsOpen = true; #endif }