void dayBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.Source is DayBoxControl) { //VisualTreeAdapter t = new VisualTreeAdapter(e.OriginalSource as DependencyObject); //DependencyObject k = t.Parent; if (e.OriginalSource is TextBlock) { TextBlock t = e.OriginalSource as TextBlock; if (t.Name.Equals("DisplayText")) { return; } } NewAppointmentEventArgs ev = new NewAppointmentEventArgs(); DayBoxControl d = e.Source as DayBoxControl; ev.StartDate = DisplayStartDate.AddDays(Double.Parse(d.Tag.ToString()) - 1).Date; ev.RoutedEvent = DayBoxDoubleClickedEvent; RaiseEvent(ev); e.Handled = true; } }
void dayBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { if (e.Source is DayBoxControl ) { //VisualTreeAdapter t = new VisualTreeAdapter(e.OriginalSource as DependencyObject); //DependencyObject k = t.Parent; if (e.OriginalSource is TextBlock) { TextBlock t = e.OriginalSource as TextBlock; if(t.Name.Equals("DisplayText")){ return; } } NewAppointmentEventArgs ev = new NewAppointmentEventArgs(); DayBoxControl d = e.Source as DayBoxControl; ev.StartDate = DisplayStartDate.AddDays(Double.Parse(d.Tag.ToString())-1).Date; ev.RoutedEvent = DayBoxDoubleClickedEvent; RaiseEvent(ev); e.Handled = true; } }