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); } } }