예제 #1
0
        private void TimeLine_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            FrameworkElement element = null;

            try
            {
                element = ((FrameworkElement)e.OriginalSource).TemplatedParent as FrameworkElement;
            }
            catch (InvalidCastException)
            {
                return;
            }

            AllItems.ForEach(i => i.IsSelected = false);
            SelectedItem = null;
            if (element is TrackItem trackItem)
            {
                trackItem.IsSelected = true;
                SelectedItem         = trackItem;
                ItemSelected?.Invoke(trackItem, new EventArgs());
            }
            else
            {
                ItemDeselected?.Invoke(null, new EventArgs());
            }
        }