Is it possible to programatically open the details window of the timeline control by clicking on the event title area rather than the timeline event point?
Thanks for any help,
Keith
Given the information I gave you to work with...it worked great, like a charm. However, I am having one unexpected issue. I sometimes have multiple events on the same day, and no matter which EventTitle is clicked, the details are always shown for the first event on the day (which is by design or by function....as the solution is setting selected date, not selected event). For example..in the screen capture below I have added the details to each event title and the same details are given if the largemouth bass or channel catfish even are clicked.
I suspect the .selectedtime property won't work in this case. Do you have any suggestions for handling this?
Hi,
Let me give you my solution. I re-templated the default EventTitle style, adding a MouseLeftButtonDown event to the background of the grid background.
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ig:EventTitle"> <Border HorizontalAlignment="Left" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"> <Grid Background="{x:Null}" MouseLeftButtonDown="EventItemGrid_MouseLeftButtonDown"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <TextBlock Text="{TemplateBinding FormattedText}" TextWrapping="Wrap" /> <TextBlock Text="{TemplateBinding Title}" TextWrapping="Wrap" Grid.Row="1"/> </Grid> </Border> </ControlTemplate> </Setter.Value> </Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ig:EventTitle">
<Border HorizontalAlignment="Left"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{x:Null}" MouseLeftButtonDown="EventItemGrid_MouseLeftButtonDown">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Text="{TemplateBinding FormattedText}" TextWrapping="Wrap" />
<TextBlock Text="{TemplateBinding Title}" TextWrapping="Wrap" Grid.Row="1"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
Then I added this event code to step thru the visual tree parents until you get to the EventTitle so that you could get to the details information. The next step was to set the SelectedTime to the entry Time.
private void EventItemGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { Grid g = sender as Grid; DependencyObject dp = VisualTreeHelper.GetParent(g); while (dp != null && dp.GetType() != typeof(EventTitle)) { dp = VisualTreeHelper.GetParent(dp); } if (dp.GetType() == typeof(EventTitle)) { EventTitle et = dp as EventTitle; NumericTimeEntry nte = et.EventEntry as NumericTimeEntry; (this.xamTimeline1.Axis as NumericTimeAxis).SelectedTime = nte.Time; } }
private void EventItemGrid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
Grid g = sender as Grid;
DependencyObject dp = VisualTreeHelper.GetParent(g);
while (dp != null && dp.GetType() != typeof(EventTitle))
dp = VisualTreeHelper.GetParent(dp);
}
if (dp.GetType() == typeof(EventTitle))
EventTitle et = dp as EventTitle;
NumericTimeEntry nte = et.EventEntry as NumericTimeEntry;
(this.xamTimeline1.Axis as NumericTimeAxis).SelectedTime = nte.Time;
Let me know if you have any questions.
Have you come up with a method? I can set click events on EventTitles just fine, but have not been able to find a way to populate the details box.
Hi Keith,
I am looking into your question and will get back to you as soon as I’ve had a chance to look into the details.
I’ll get back to you shortly.