Page 1 of 1

WPF Derived Control

Posted: Tue Jul 07, 2009 9:02 am
by 15653447
Hi,

I'm trying to use TeeChart as derived control in a WPF application.
I've created a simple class:
public class GraphBasicControl : TChart {}

and when I try to use it (create an instance):
GraphBasicControl test = new GraphBasicControl();

I'm getting an exception:
"
The component 'GraphExtendedPH' does not have a resource identified by the URI '/TeeChart.WPF;component/wpfteechart.xaml'.
"

If I try to continue, then everything is working fine.

Please advice.

- Sharon

Re: WPF Derived Control

Posted: Tue Jul 07, 2009 11:40 am
by yeray
Hi Sharon,

Could you please send us a simple example project we can run as-is to reproduce the problem here? (Note that you can attach files directly with the forum messages)

Re: WPF Derived Control

Posted: Tue Jul 07, 2009 11:53 am
by 15653447
Hi,

Thanks for replying. It's actually very simple:
Create a WPF Application:

Code: Select all

public class ChartDemo : TChart
        {
        }        

        public Window1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            ChartDemo chartDemo = new ChartDemo();
        }
I've attached a sample project, just in case.
BTW, I'm having other strange issues with the WPF version, I've worked with the WinForm version and now I'm converting it to WPF.
I'm using a DLL to wrap TeeChart with the functioinlity required by our application, I can skip the exception, if I continue the program execution after the exception, the chart is loading. When I try to show the TeeChart editor, nothing happens:
TeeChartControlInstance.ShowEditor();

Please advice.

- Sharon

Re: WPF Derived Control

Posted: Tue Jul 07, 2009 2:08 pm
by yeray
Hi Given,

Yes you are right, I've added this bug to the wish list to be fixed asap (TW16014279).

And regarding the editor, here it was discussed.

Re: WPF Derived Control

Posted: Tue Jul 07, 2009 2:29 pm
by 15653447
Hi Alonso,

Thanks for the reply.

1. Do you have any time estimation when this will be fixed and how (patch/new version)?
2. I have some other critical problems with the WPF version. This is the one I'm working on:
In the WinForm version, I've added a scroll bar in case the user zoom in, this was quite complex since the bottom axis is using datetime format but I've managed to handle it.
The control I've used was HScrollBar, which of course, I cannot use now, instead I'm using ScrollBar which is UIElement.
In the previous version, the HScrollBar was added to the "Controls" of the chart:

Code: Select all

m_BasicGraph.Children.Add(m_HScrollBar);
this cannot be done with WPF, hence I'm *trying* to use "Children":

Code: Select all

m_BasicGraph.Children.Add(hSBar);
The problem is that "Children" is not set properly in the chart, whenever I try to use it I'm getting an exception: "'m_BasicGraph.Children' threw an exception of type 'System.NullReferenceException'"

I don't think a sample project is required, just open the debugger and try to access the "Children" and you will see the problem.

Please advice.

Re: WPF Derived Control

Posted: Wed Jul 08, 2009 1:26 pm
by yeray
Hi Given,

1. We plan to publish a new NET maintenance release for v2009 around 12th August but I'm afraid that I can't tell you if this will be fixed or not. I recommend you to be aware at this forum or subscribe to our RSS news feed for new release announcements and what's implemented on them.

2. I'm getting an error adding controls created in design time into a chart but also into other components so it doesn't seem to be a TeeChart problem. For example, once a scroll bar is created at design time, the following crashes:

Code: Select all

tChart1.Children.Add(scrollBar1);
But this crashes too:

Code: Select all

dockPanel1.Children.Add(scrollBar1);
On the other hand, creating the controls at runtime, both adding them to the chart or to the panel it seems to work fine:

Code: Select all

System.Windows.Controls.Primitives.ScrollBar myScrollBar = new System.Windows.Controls.Primitives.ScrollBar();
tChart1.Children.Add(myScrollBar);

Code: Select all

System.Windows.Controls.Primitives.ScrollBar myScrollBar = new System.Windows.Controls.Primitives.ScrollBar();
dockPanel1.Children.Add(myScrollBar);