Controls: Add UnitTextBox
This commit is contained in:
31
Elwig/Controls/UnitTextBox.xaml.cs
Normal file
31
Elwig/Controls/UnitTextBox.xaml.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user