c#


UWP ProgressBar and Binding


I have very strange situation with updating ProgressBar.
Basically, I have SemanticZoom and in ZoomedIn mode I have ListView. Each ListView contains ProgressBar. And here's the most interesting.
Working (values set by me):
<ProgressBar Minimum="1488240000" Maximum="1488241000" Value="{Binding CurrentTime, Mode=OneWay}" />
Not working (values are binding):
<ProgressBar Minimum="{Binding Start, Mode=OneTime}" Maximum="{Binding Finish, Mode=OneTime}" Value="{Binding CurrentTime, Mode=OneWay}" />
The way it's not working like that:
Start is binded, OK. Finish is binded, OK. CurrentTime is binded, PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentTime))) trigged, but here:
public double CurrentTime
{
get
{
return currentTime;
//It's trigged only first time
//But should be triggered every time PropertyChanged triggered
}
set
{
currentTime = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(CurrentTime)));
//It's OK, it's trigged every time I update this property
}
}
So, there's definitely something up to getter. Any ideas?
By the way, when I play with position of properties of ProgressBar I have strange results. For example, if I set Minimum, then Maximum and then Value I have ProgressBar 100%. If I set Value, Maximum and Minimum - it's OK.
When binding Minimum and Maximum values in Extensible Application Markup Language (XAML), declare the Binding for Maximum first. If the Binding for Maximum is declared after Minimum, the bound value for Maximum is ignored and the following situations can occur:
If the bound Minimum value is negative, the Maximum value is set to 0.
If the bound Minimum value is greater than the default Maximum (100 for Slider and ProgressBar), the Maximum value is set equal to the Minimum value.
To avoid this behavior, declare the Binding for Maximum first in your Extensible Application Markup Language (XAML).
For more info, please see Note under Maximum property.
And while binding Value property, the Binding must be TwoWay. So you can change your code like the following:
<ProgressBar Maximum="{Binding Finish, Mode=OneTime}" Minimum="{Binding Start, Mode=OneTime}" Value="{Binding CurrentTime,Mode=TwoWay}" />
Then it should be able to work.
I think this will fix it
<ProgressBar
Minimum="{Binding Min, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Maximum="{Binding Max, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Value="{Binding Progress, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
</ProgressBar>

Related Links

How to tell if JSON result has object or array?
Combine projects and run forms from TabPages
Error while calling Matrices Multiplication Function in C#
Azure Queue client Dependency injection
Storyboard inside a user control is not working
How do I generate and write XML file of this format?
ssisUnit & SSIS package
How to get an un-parameterized type from an parameterized generic type?
Why does GetThreadTimes return
Detect if user is scrolling dataGridView scrollbar
Namespace can't be referenced from another namespace in same project - App_Code
NullReferenceException where only variables are structs
How to send strings from an Peer-To-Peer server to a client using Unity C#?
N-Tier Application With Entity Framework
Schema to validate a .xsl template in C#
C# - app.manifest error

Categories

HOME
c#
internet-explorer
ide
reference
salesforce-lightning
xss
multipartform-data
google-api-oauth
webpack-dev-server
jcodemodel
fetch
point-of-sale
chef-recipe
yui
owncloud
versioning
simd
reportlab
virtuemart
alert
android-navigation-drawer
onclicklistener
concatenation
apdu
android-cursorloader
multiple-inheritance
dynamic-memory-allocation
javapns
andengine
login-required
loopback
oracle-nosql
node-soap
offset
incapsula
mkdir
campaign-monitor
client-server
word-wrap
iterm2
ngrok
rbac
collation
contenteditable
smooth-streaming
api-key
ack
spring-data-commons
activeandroid
hierarchical-clustering
stream-socket-client
ionic2-select
beanshell
e4
enet
suitesparse
cedar-bdd
dimensionality-reduction
geokit
syslog4j
normalisation
sprockets
bytearray
web-optimization
custom-build-step
methodology
jquery-draggable
sdkman
javapackager
jts
hexagonal-tiles
borland-c++
clearquest
grails-3.0.9
gmaps4jsf
touch-typing
illegalargumentexception
nsnotificationcenter
system.net
selenium-grid2
indic
telerik-appbuilder
webshim
cvi
mongoid4
panelgrid
blotter
yii-components
teamsystem
xcode4.6.3
google-email-audit-api
winrt-async
socketasynceventargs
jqueryi-ui-buttonset
zend-validate
wdm
chars
mediastreamsource
nstoolbar
for-xml
morfik
file-storage
script-tag
file-icons
bootstrap-protocol
jgrowl
j++

Resources

Encrypt Message