I have a progress bar associated with 2 integer values. One of them is seconds, and the second is the remaining seconds (which counts down the timer: always <= Total seconds).
I have a LayoutRoot datacontext parameter set for my top-level object (from which BlindSet is the -see code property).
When I run the project, the progress bar updates perfectly. It counts the number of seconds as expected. Then I modify the datacontext by instantiating a new object and setting it to the BlindSet class. I am using DataChanged notification events to let the user interface know that it has changed. This also works well - all other controls, EXCEPT the progress bar, update accordingly.
This puzzled me, so I simplified this:
2 text blocks and a progress bar, all tied to the same values. Datacontext is installed above, so it is the same for everyone.
The text blocks display the correct values counting the value. (BlindSet.TimeLeftInCurrentBlind.TotalSeconds counts the timer), but the progress bar never updates after I change the datacontext. I even tried to restore it after changing the data, but that did not help.
I also bind the ToolTip on the progress bar to the same value as the value set to - and when you hover over the update line that is not updating, you can see that it is counting correctly ... but the progress indicator does not show it.
Either I'm doing something really stupid (maybe;), or it's a mistake in controlling the execution control.
XAML:
<TextBlock Text="{Binding BlindSet.CurrentBlind.SecondsPerBlind}" />
<TextBlock Text="{Binding BlindSet.TimeLeftInCurrentBlind.TotalSeconds}" />
<ProgressBar Minimum="0" Maximum="{Binding BlindSet.CurrentBlind.SecondsPerBlind}" Value="{Binding BlindSet.TimeLeftInCurrentBlind.TotalSeconds}" ToolTipService.ToolTip="{Binding BlindSet.TimeLeftInCurrentBlind.SecondsPerBlind}" />
Code behind:
LayoutRoot.DataContext = tournament;
the tournament has a BlindSet object, but I don’t think this is part of the problem, as the other controls are perfectly updating:
public Blindset BlindSet
{
get { return blindset; }
set
{
if (blindset != value)
{
blindset = value;
OnPropertyChanged("BlindSet");
OnPropertyChanged("CurrentBlind");
}
}
}
. , , max value datacontext ( , , 1200 120 ).
BlindSet ( 1200 ), , , , - - , ?!