This is a migrated thread and some comments may be shown as answers.

ChartTrackBallBehavior CommandParameter Issue

4 Answers 127 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Klemens
Top achievements
Rank 1
Klemens asked on 12 Sep 2013, 08:03 AM
Hi,
first of all I'm using the MVVM pattern.

In order to get the ActualVisibleRange from my DateTimeContinuousAxis i hooked up to the LayoutUpdated event and passed the axis via the CommandParameter:

<telerik:DateTimeContinuousAxis x:Name="horizontalAxis" LabelFormat="dd.MM hh:mm" LabelFitMode="MultiLine">   
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="LayoutUpdated">
            <i:InvokeCommandAction Command="{Binding LayoutUpdatedCommand}" CommandParameter="{Binding ElementName=horizontalAxis}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</telerik:DateTimeContinuousAxis>


When I apply this pattern to the ChartTrackBallBehavior to pass the Data of the Behavior i got an error:

<telerik:ChartTrackBallBehavior x:Name="trackBallBehavior" ShowTrackInfo="True">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="TrackInfoUpdated">
            <i:InvokeCommandAction Command="{Binding TrackInfoUpdatedCommand}" CommandParameter="{Binding ElementName=trackBallBehavior}"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>
</telerik:ChartTrackBallBehavior>


Is there an alternative way to pass the data of the ChartTrackBallBehavior to my ViewModel?

Regards Markus

4 Answers, 1 is accepted

Sort by
0
Klemens
Top achievements
Rank 1
answered on 13 Sep 2013, 07:29 AM
Small update,

when I use Caliburn Micro to pass the EventArgs like this:

<telerik:ChartTrackBallBehavior ShowTrackInfo="True" cal:Message.Attach="[TrackInfoUpdated] = [TrackInfoUpdated($eventArgs)]"/>

It compiles but on start i got the same exception: XamlParseException

Greetings Markus
0
Petar Kirov
Telerik team
answered on 17 Sep 2013, 09:58 AM
Hi Markus,

Thanks for reporting this problem. I was able to reproduce it. It seams that EventTrigger does not supported forwarding events from non UIElement-derived classes. (ChartBehaviors do not derive from UIElement for performance considerations.)

I have notified our development team, so they can investigate it more thoroughly. You can follow the progress of this item here on PITS.
For the time being, you will need to use event handler in code-behind to call the ViewModel's command.
 

Regards,
Petar Kirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Klemens
Top achievements
Rank 1
answered on 17 Sep 2013, 12:13 PM
Thank you very much!
0
James
Top achievements
Rank 1
answered on 02 Oct 2013, 06:13 PM
Hi - if you subclass ChartTrackBallBehavior with your own custom behavior and hook an ICommand Dependency property to the TrackInfoUpdated event you can use this so that everytime this event fires it calls your Command Delegate on your view model.. I've written a class which will do this today - would you like the source code? It works pretty well and updates the title of the tracker ball on my chart each time I focus on a new point on the series..

Best Regards,

James. 


Tags
ChartView
Asked by
Klemens
Top achievements
Rank 1
Answers by
Klemens
Top achievements
Rank 1
Petar Kirov
Telerik team
James
Top achievements
Rank 1
Share this question
or