Controls: Add UnitTextBox

This commit is contained in:
2023-11-04 21:40:54 +01:00
parent 12226c3d0f
commit 6435a649b4
12 changed files with 118 additions and 57 deletions

View File

@ -0,0 +1,31 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
namespace Elwig.Controls {
public partial class UnitTextBox : UserControl {
public event TextChangedEventHandler? TextChanged;
public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(UnitTextBox));
public string Text {
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
public static readonly DependencyProperty UnitProperty = DependencyProperty.Register("Unit", typeof(string), typeof(UnitTextBox));
public string Unit {
get => (string)GetValue(UnitProperty);
set => SetValue(UnitProperty, value);
}
public UnitTextBox() {
InitializeComponent();
DataContext = this;
}
private void TextBox_TextChanged(object sender, TextChangedEventArgs evt) {
if (TextChanged != null) TextChanged(sender, evt);
}
}
}