private void MsTextBox_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { var textbox = (sender as TextBox); if (textbox != null && !textbox.IsKeyboardFocusWithin) { //string originalSourseName = e.OriginalSource.GetType().Name; if (e.OriginalSource.GetType().Name == "TextBoxView") { e.Handled = true; textbox.Focus(); } else { Button clearButton = VisualHelper.GetParent <Button>(e.OriginalSource as DependencyObject); if (clearButton != null) { if (clearButton.Name == ElemenetClearButton) { this.Text = String.Empty; } } } } }
private void MsSlider_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { MsSlider slider = sender as MsSlider; Thumb thumb = VisualHelper.GetParent <Thumb>(e.OriginalSource as DependencyObject); if (thumb != null) { //slider.Value = (Math.Abs(slider.Maximum) - Math.Abs(slider.Minimum)) / 2; slider.Value = slider.DefaultValue; } }