GithubHelp home page GithubHelp logo

Comments (4)

javiercn avatar javiercn commented on June 5, 2024

@GreggAtCarfac thanks for contacting us.

You might be looking for MobileBlazorBindings. If you are looking for some way of using MVVM with Blazor components, I do not think there is anything that prevents you from doing so, but we do not have plans to more directly support the pattern in the framework.

Whether it is one or the other, none of the two pieces at this point are committed.

/cc: @Eilon

from mobileblazorbindings.

GreggAtCarfac avatar GreggAtCarfac commented on June 5, 2024

@javiercn Sorry is not resolved. yes the mobileblazorbindings is what i am doing. but it does not work multi screen. in a desktop wpf project i have 2 screens sharing the same viewmodel but if i click the counter button 3 times on screen 1 i see the counter increase from 0 to 1, then to 2 and finally 3 but on screen 2 it remains zero. if i then press the counter button on screen 2 once it jumps to 4. so i am sure they share the same viewmodel. and i do call the onproperychanged event so i would expect screen 2 to update if the counter on screen 1 button is pushed.

from mobileblazorbindings.

Eilon avatar Eilon commented on June 5, 2024

I transfered this to the Mobile Blazor Bindings repo.

I'm not familiar with how multi-screen/window works, but in any case, to get each page to update you'll need the model type to have some sort of change notification that occurs any time the model (such as the counter value) changes. Then each page using that model can listen to that change notification and call StateHasChanged() to cause the UI to update.

To see an example, look at how and where this event is used in a ToDo sample app: https://github.com/dotnet/MobileBlazorBindings/blob/main/samples/MobileBlazorBindingsToDo/AppState.cs#L31

from mobileblazorbindings.

GreggAtCarfac avatar GreggAtCarfac commented on June 5, 2024

@Eilon Thanks for the help. Your solution worked. Its a but sad that you have to force the screens to update through the StateHasChanged() event on the blazor pages themselves. You would think as the view is bound through dependency injection with its viewmodel a simple onpropertychanged event on the viewmodel would be enough and no code is needed on the view. I hope the developers will add this in a future release.

from mobileblazorbindings.

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.