ProgressBar does not update correctly until hot reload.
Code: Select all
<TextBlock Text="{Binding Relay.DaysUntilCompletion, StringFormat=Days Left: {0}}" />
<TextBlock Text="{Binding Relay.DaysPerDelivery, StringFormat=Days per delivery: {0:N1}}" />
<TextBlock>
<Run Text="{Binding Relay.TotalDelivered, StringFormat=Amount Delivered: {0} /}" /> <Run Text="{Binding Relay.CurrentOrder.Amount}" />
</TextBlock>
<ProgressBar
Height="20"
Margin="0,5"
Maximum="{Binding Relay.Distance}"
Minimum="0"
Value="{Binding Relay.Timer}" />
Code: Select all
public class RelayVM : VM
{
public TransportRelay Relay { get; }
public RelayVM(TransportRelay relay)
{
Relay = relay;
}
}
Note that other controls are binding to properties in Relay and are updating correctly without needing a hot reload. Also, once a hot reload is complete the Timer & Distance properties update when they should (not just once) so they do implement property changed correctly.
Video: https://files.catbox.moe/tieful.mp4
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ProgressBar does not update correctly until hot reload.
Is it possible that Distance does not notify the property change? The only thing I can think of is that initially it has a value of 0, the datacontext is set, and later Distance property is updated but not notified to the UI. It will work when doing the hot-reload because then the Relay object already has the Distance property correctly set.
I tried to reproduce your scenario but it works for me, even if I set the Distance property later.
I tried to reproduce your scenario but it works for me, even if I set the Distance property later.
Re: ProgressBar does not update correctly until hot reload.
But from the video, the Distance property updates every time the date changes - not just initially after the hot reload. The Distance property implements the property change like all other properties in my project. If I bind the Distance to a TextBox's Text, the text updates correctly without having to hot reload.
I don't need this progress bar anymore, so it isn't an issue for me... It seems other progress bars work in my project. I am free to send you the project if you want, or if you think it was on my end that's fine too and I can mark this as solved : )
I don't need this progress bar anymore, so it isn't an issue for me... It seems other progress bars work in my project. I am free to send you the project if you want, or if you think it was on my end that's fine too and I can mark this as solved : )
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: ProgressBar does not update correctly until hot reload.
From the xaml I assumed the Distance property was set only once (as it is the Maximum of the progress bar), and the Timer property (bound to progress bar's Value) was the one changing.
If you can provide a way to reproduce this I can take a look to see if there is something wrong on our side.
If you can provide a way to reproduce this I can take a look to see if there is something wrong on our side.
Who is online
Users browsing this forum: No registered users and 77 guests