wpf - Declarative progress bar binding -


after binding command of button action, call object exposes progress event.

event system.eventhandler<progresschangedeventargs> progresschanged 

i display in xaml in best way.


one way can expose 2 bindable fields in vm

member x.iteration get()     = _iteration                    , set(v:int) = _iteration <- v                                     x.notifypropertychanged <@this.iteration@>  member x.iterationvisible get()      = _iterationvisible                           , set(v:bool) = _iterationvisible <- v                                             x.notifypropertychanged <@this.iterationvisible@> 

then called perform action update properties

member x.completeinference(algorithm:igeneratedalgorithm) =     x.iterationvisible <- true     algorithm.progresschanged.add(fun args -> x.iteration <- args.iteration)     algorithm.run()     x.iterationvisible <- false 

that leads 2 questions :

  • is there direct way in f# expose progresschanged event, without going through intermediate iteration property, can processed wpf ? declarative can / have store state somewhere ?

  • additionaly, there natural way 'state machine' binding entirely in xaml ?

to knowledge there no way handle events in xaml, exposing event changes through property best can do.

to achieve "'state machine' binding" in xaml, expose progress size , bind width of progress bar property. see here example of this.


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -