Search code examples
c#.netchartsteechart

TeeChart ScrollPager tool doesn’t work in WPF project


I want to use TeeChart (http://www.teechart.net/) ScrollPager tool in my WPF project, but it doesn’t work. (TeeChart.WPF.dll version 4.1.2012.2287)

http://img190.imageshack.us/img190/4900/scrwpf.png

namespace TeeChart
{
    using Steema.TeeChart.WPF.Themes;
    using Steema.TeeChart.WPF.Tools;
    using Steema.TeeChart.WPF.Styles;
    using Steema.TeeChart.WPF.Drawing;

    public partial class MainWindow
    {
        private Line _series;
        private ScrollPager _tool;
        BlackIsBackTheme _black; 

        public MainWindow()
        {
            InitializeComponent();

            _series = new Line();
            tChart1.Series.Add(_series);
            tChart1.Chart.Aspect.View3D = false;
            tChart1.Header.Visible = false;
            tChart1.Legend.Visible = false;

            _series.FillSampleValues(500);

            _black = new BlackIsBackTheme(tChart1.Chart);
            _black.Apply();


            _tool = new ScrollPager();
            tChart1.Tools.Add(_tool);

            _tool.Series = _series;
            _black = new BlackIsBackTheme(_tool.SubChartTChart.Chart);
            _black.Apply();

            _tool.SubChartTChart.Panel.Pen.Visible = false;
            _tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
            _tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
        }
    }
}



In WinForms project it works fine.
http://img692.imageshack.us/img692/4527/scrwinforms.png

namespace TeeChartWinForms
{
    using System.Windows.Forms;
    using Steema.TeeChart.Drawing;
    using Steema.TeeChart.Styles;
    using Steema.TeeChart.Themes;
    using Steema.TeeChart.Tools;

    public partial class Form1 : Form
    {
        private Line _series;
        private ScrollPager _tool;
        BlackIsBackTheme _black; 


        public Form1()
        {
            InitializeComponent();

            _series = new Line();
            tChart1.Series.Add(_series);
            tChart1.Chart.Aspect.View3D = false;
            tChart1.Header.Visible = false;
            tChart1.Legend.Visible = false;

            _series.FillSampleValues(500);

            _black = new BlackIsBackTheme(tChart1.Chart);
            _black.Apply();


            _tool = new ScrollPager();
            tChart1.Tools.Add(_tool);

            _tool.Series = _series;
            _black = new BlackIsBackTheme(_tool.SubChartTChart.Chart);
            _black.Apply();

            _tool.SubChartTChart.Panel.Pen.Visible = false;
            _tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
            _tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
        }
    }
}



Thanks,
Alex


Solution

  • Seems that your problem doesn't appear using next code:

    Code c#:

      using System;
        using System.Collections.Generic;
        using System.Linq;
        using System.Text;
        using System.Windows;
        using System.Windows.Controls;
        using System.Windows.Data;
        using System.Windows.Documents;
        using System.Windows.Input;
        using System.Windows.Media;
        using System.Windows.Media.Imaging;
        using System.Windows.Navigation;
        using System.Windows.Shapes;
        using Steema.TeeChart.WPF;
        using Steema.TeeChart.WPF.Styles;
        using System.IO;
        using System.Windows.Markup;
        using Steema.TeeChart.WPF.Tools;
        using Steema.TeeChart.WPF.Drawing;
        using Steema.TeeChart.WPF.Themes;
        namespace WpfApplication1
        {
            public partial class MainWindow : Window
            {
                private Steema.TeeChart.WPF.Styles.Line series;
                private ScrollPager tool;
                BlackIsBackTheme black; 
        
                public MainWindow()
                {
                    InitializeComponent();
        
                    series = new Steema.TeeChart.WPF.Styles.Line();
                    tChart1.Series.Add(series);
                    tChart1.Chart.Aspect.View3D = false;
                    tChart1.Header.Visible = false;
                    tChart1.Legend.Visible = false;
        
                    series.FillSampleValues(500);
        
                    black = new BlackIsBackTheme(tChart1.Chart);
                    black.Apply();
        
        
                    tool = new ScrollPager(tChart1.Chart);
        
                    tool.Series = series;
                    black = new BlackIsBackTheme(tool.SubChartTChart.Chart);
                    black.Apply();
        
                    tool.SubChartTChart.Panel.Pen.Visible = false;
                    tool.SubChartTChart.Panel.Bevel.Inner = BevelStyles.None;
                    tool.SubChartTChart.Panel.Bevel.Outer = BevelStyles.None;
                }
    }
    }
    

    code xaml:

    <Window x:Class="WpfApplication1.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:tc="clr-namespace:Steema.TeeChart.WPF;assembly=TeeChart.WPF"
            Title="MainWindow" SizeToContent="WidthAndHeight" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="516" d:DesignWidth="492">
        <Grid >
            <AdornerDecorator Margin="25,12,27,65">
                <tc:TChart Name="tChart1" Height="226" Width="412" />
            </AdornerDecorator>
        
        </Grid>
    
    </Window>
    

    And I get the same results as winforms. Please try again if using my code your problem are solved or it still appears. If your problem doesn't solve could you please send a simple example project we can run "as-is" to reproduce the problem here at steema.net/upload?

    Thanks,

    Best regards

    Sandra