Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2085
Classes inheriting from DateTimeEntry are not used in Event Callbacks?
posted

I have a class that inherits from DateTimeEntry:

 

public class ConstraintDateTimeEntry : DateTimeEntry

 

I set a collection ObservableCollection<ConstraintDateTimeEntry> of these into the time line:

           

DateTimeSeries outageSeries = new DateTimeSeries();

outageSeries.Title ="Outage Periods";

outageSeries.DataSource = displayedOutageEntries;

outageSeries.DataMapping = "Time=Time;Duration=Duration;Title=Title;Details=Details";

outageSeries.Position = Position.TopOrLeft;

m_xamTimeline.Series.Add(outageSeries);

 

I have a right-click context menu setup on the DateTimeEvent's title that invokes an event callback with this logic:

 

ConstraintDateTimeEntry entry = ((menu.PlacementTargetResolved as Border).TemplatedParent as EventTitle).EventEntry as ConstraintDateTimeEntry;

 

This code results in a null "entry" variable because the type of the EventEntry property is DateTimeEntry, NOT ConstraintDateTimeEntry.  Why do I get a type I never added to the series/timeline and how to I get which ConstraintDateTimeEntry corresponds to the title clicked on?