private void textBox1_TextChanged(object sender, TextChangedEventArgs e) { byte red = (byte)_count; byte green = 150, blue = 150; if (_count + 150 > 255) { red = 255; blue = 0; green = 0; } else { red = (byte)((int)150 + (int)_count); blue = (byte)((int)150 - (int)_count); green = blue; } lblSMScount.Foreground = ExtensionServices.fromRGB(red, green, blue); if (Keyboard.IsKeyDown(Key.Back)) { _count -= 1; } else { _count += 1; } lblSMScount.Content = _count + "/160"; }
private void DataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e) { var ec = ExtensionServices.GetVisualChild <TextBox>(e.EditingElement as ContentPresenter); if (ec != null) { ec.SelectAll(); } }
private void FocusFirstEditor() { var c = ExtensionServices.GetVisualChild <TextBox>(CustomEditors); if (c != null) { c.BackgroundFocus(); } }
public string Send(Message model) { try { ExtensionServices.SendMessage(model.Users, model.Content); } catch (Exception e) { return(e.Message); } return(null); }
static void VisualLoaded(object sender, RoutedEventArgs e) { var fe = sender as FrameworkElement; if (fe != null) { var v = ExtensionServices.GetVisualChild <ScrollViewer>(fe); if (v != null) { AttachScrollViewer(v, true); fe.Loaded -= VisualLoaded; } } }
private static void AttachScrollViewer(DependencyObject d, bool newValue) { var scoller = d as ScrollViewer; if (scoller != null) { if (newValue) { scoller.PreviewMouseLeftButtonDown += ScollerPreviewMouseLeftButtonDown; scoller.PreviewMouseLeftButtonUp += ScollerPreviewMouseLeftButtonUp; scoller.PreviewMouseMove += ScollerPreviewMouseMove; SetInertiaProcessor(scoller, new InertiaHandler(scoller)); } else { scoller.PreviewMouseLeftButtonDown -= ScollerPreviewMouseLeftButtonDown; scoller.PreviewMouseLeftButtonUp -= ScollerPreviewMouseLeftButtonUp; scoller.PreviewMouseMove -= ScollerPreviewMouseMove; var inertia = GetInertiaProcessor(scoller); if (inertia != null) { inertia.Dispose(); } } } else { var sbar = ExtensionServices.GetVisualChild <ScrollViewer>(d); if (sbar != null) { AttachScrollViewer(sbar, newValue); } else { var visual = d as FrameworkElement; if (visual != null) { visual.Loaded += VisualLoaded; } } } }