new version :

Diagram Rotate thumb optional through VisualExtensions,
1 new behavior,
BrightSharpWindowStyle release candidate,
style.blue fix,
TabControl + leadingelement,
Expander toggle on full header width
This commit is contained in:
2017-08-19 15:10:31 +03:00
parent c8b1c5e82c
commit 63aff83e1d
9 changed files with 230 additions and 143 deletions

View File

@@ -0,0 +1,33 @@
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Interactivity;
namespace BrightSharp.Behaviors
{
public class SelectAllTextOnFocusBehavior : Behavior<TextBoxBase>
{
protected override void OnAttached() {
base.OnAttached();
AssociatedObject.GotKeyboardFocus += AssociatedObjectGotKeyboardFocus;
AssociatedObject.PreviewMouseLeftButtonDown += AssociatedObjectPreviewMouseLeftButtonDown;
}
protected override void OnDetaching() {
base.OnDetaching();
AssociatedObject.GotKeyboardFocus -= AssociatedObjectGotKeyboardFocus;
AssociatedObject.PreviewMouseLeftButtonDown -= AssociatedObjectPreviewMouseLeftButtonDown;
}
private void AssociatedObjectGotKeyboardFocus(object sender,
KeyboardFocusChangedEventArgs e) {
AssociatedObject.SelectAll();
}
private void AssociatedObjectPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
if (!AssociatedObject.IsKeyboardFocusWithin) {
AssociatedObject.Focus();
e.Handled = true;
}
}
}
}