mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Display conditions - Implemented most of static input
This commit is contained in:
1 parent
2ad78411c8
commit
f9e516197f
14 files changed
+248
-30
No files matched your search
@@ -0,0 +1,34 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Microsoft.Xaml.Behaviors;
|
||||
|
||||
namespace Artemis.UI.Shared.Behaviors
|
||||
{
|
||||
public class PutCursorAtEndTextBoxBehavior : Behavior<UIElement>
|
||||
{
|
||||
private TextBox _textBox;
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
_textBox = AssociatedObject as TextBox;
|
||||
|
||||
if (_textBox == null) return;
|
||||
_textBox.GotFocus += TextBoxGotFocus;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
if (_textBox == null) return;
|
||||
_textBox.GotFocus -= TextBoxGotFocus;
|
||||
|
||||
base.OnDetaching();
|
||||
}
|
||||
|
||||
private void TextBoxGotFocus(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
_textBox.CaretIndex = _textBox.Text.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user