Coder Social home page Coder Social logo

Comments (13)

isaacabraham avatar isaacabraham commented on June 25, 2024 1

My bad. I have a bit of time tomorrow and I'll try to repro it, or close if I can't.

from fsharp.viewmodule.

FoggyFinder avatar FoggyFinder commented on June 25, 2024

@isaacabraham Can you provide MCVE?

from fsharp.viewmodule.

isaacabraham avatar isaacabraham commented on June 25, 2024

At the moment, no - at this point, before I do that, I'm just trying to understand if what I'm doing is correct i.e. should calling RaiseCanExecuteChange() on a command force WPF to call CanExecuteChanged on the command?

from fsharp.viewmodule.

giuliohome avatar giuliohome commented on June 25, 2024

Maybe it's just a typo, but in the first command (the one that executes) you raise the Changed of the second (the one that you want to force recheck). It looks like you wrote the opposite : -)

from fsharp.viewmodule.

isaacabraham avatar isaacabraham commented on June 25, 2024

@giuliohome good spot - fixed :-)

from fsharp.viewmodule.

FoggyFinder avatar FoggyFinder commented on June 25, 2024

I just can't understand the problem, maybe you want to use dependencies?

from fsharp.viewmodule.

isaacabraham avatar isaacabraham commented on June 25, 2024

@FoggyFinder that's what I was using originally but due to the way that the view model is now working, it's not possible any more - hence why I'm now explicitly trying to force the second command to refresh it's can execute state.

from fsharp.viewmodule.

ReedCopsey avatar ReedCopsey commented on June 25, 2024

from fsharp.viewmodule.

ReedCopsey avatar ReedCopsey commented on June 25, 2024

@isaacabraham Any update on this? Want to figure out whether it's a problem in the library, or something else...

from fsharp.viewmodule.

ReedCopsey avatar ReedCopsey commented on June 25, 2024

@isaacabraham Thanks - Just don't want to leave you in the dark if it's something I can fix

from fsharp.viewmodule.

isaacabraham avatar isaacabraham commented on June 25, 2024

Here's a simple repro: -

https://github.com/isaacabraham/viewmodel-command

from fsharp.viewmodule.

ReedCopsey avatar ReedCopsey commented on June 25, 2024

@isaacabraham The problem is that you weren't actually ever calling RaiseCanExecuteChanged on the instance bound in the view. Since you were creating the command directly in the property get code, a new instance is constructed each time you call vm.DependentCommand - that new instance becomes enabled, but the view still was holding onto the original instance.

I've put in a PR against your repo to illustrate how to fix, with comments.

from fsharp.viewmodule.

isaacabraham avatar isaacabraham commented on June 25, 2024

Thanks for this @ReedCopsey - much appreciated!

from fsharp.viewmodule.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.