…
public MainWindow()
{
InitializeComponent();
Gantt.Loaded += Gantt_Loaded;
}
private void Gantt_Loaded(object sender, RoutedEventArgs e)
{
GanttChart chart = this.Gantt.FindElementOfType<GanttChart>();
chart.PreviewMouseLeftButtonDown += Chart_PreviewMouseLeftButtonDown;
}
private void Chart_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
Border border = e.OriginalSource as Border;
if (border != null && border.DataContext is Item)
{
// You can get the selected inline item from its dataContext as like below.
Item selectedInLineItem = border.DataContext as Item;
}
}
… |