NumberBox does not update the displayed value (Text property) after changing Value property if the control is not empty.
To Reproduce
Steps to reproduce the behavior:
- Create NumberBox
<wpfui:NumberBox x:Name="TEST" MinWidth="100" Step="1" Min="1" Max="100" />
- Create button with click event
<Button x:Name="Button" Content="Change Value" Click="Button_Click" />
private void Button_Click(object sender, RoutedEventArgs e) {
TEST.Value = 20;
}
- Run application and set NumberBox to 13 (or any other number)
- Click button, notice that NumberBox still displays original number
Expected behavior
I expect when changing Value for the new number to be reflected in the NumberBox
Desktop (please complete the following information):
- OS: Windows 10
- .NET: net6.0
- Version: WPFUI 1.2.7
Additional context
This appears to be an issue in Value_PropertyChanged:
|
if (!String.IsNullOrEmpty(control.Text)) |
If the string is not null or empty the code returns. I’d be happy to submit a pull request but not sure what the intent of this line is.
In the mean time the simple workaround is to set Text and Value properties.
Thanks for the great library!
NumberBox does not update the displayed value (Text property) after changing Value property if the control is not empty.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect when changing Value for the new number to be reflected in the NumberBox
Desktop (please complete the following information):
Additional context
This appears to be an issue in
Value_PropertyChanged:wpfui/src/WPFUI/Controls/NumberBox.cs
Line 189 in 8883c3a
If the string is not null or empty the code returns. I’d be happy to submit a pull request but not sure what the intent of this line is.
In the mean time the simple workaround is to set
TextandValueproperties.Thanks for the great library!