// // Copyright 2014 Perforce Software Inc. // using System.Windows; using System.Windows.Controls; namespace Perforce.View { public class UIBehaviors { public static readonly DependencyProperty SelectTextOnFocusProperty = DependencyProperty .RegisterAttached("SelectTextOnFocus", typeof(bool), typeof(UIBehaviors), new FrameworkPropertyMetadata(false, GotFocus)); public static void SetSelectTextOnFocus(DependencyObject obj, bool value) { obj.SetValue(SelectTextOnFocusProperty, value); } private static void GotFocus(DependencyObject d, DependencyPropertyChangedEventArgs e) { var textbox = d as TextBox; if (null == textbox) return; textbox.GotKeyboardFocus += SelectTextOnFocus; textbox.GotMouseCapture += SelectTextOnFocus; } private static void SelectTextOnFocus(object sender, RoutedEventArgs e) { if (!(sender is TextBox)) return; ((TextBox)sender).SelectAll(); } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 15071 | alan_petersen |
Populate -o //guest/perforce_software/piper/... //guest/alan_petersen/piper/.... |
||
//guest/perforce_software/piper/windows/main/Perforce/View/UIBehaviors.cs | |||||
#1 | 11255 | alan_petersen | Rename/move file(s) | ||
//guest/perforce_software/piper/windows/Perforce/View/UIBehaviors.cs | |||||
#1 | 10761 | alan_petersen |
initial drop of Piper for Windows.... this version still has _many_ bugs (er... i mean "unintended features") but I will be updating it over the next week as more stability is added. |