viewmodel

Binding a variable inside a viewmodel to a different variable in another viewmodel

Deadly 提交于 2020-01-16 13:29:13
问题 I'm implementing a WPF application using the MVVM pattern. The application is basically a communications panel (comms panel) with control widgets laid on top of it (e.g., dial pads, intercom lines, etc). The control widgets have also been implemented using the MVVM pattern, as this allows us to easily test them on an individual basis. I have this "dial pad" control widget, which exposes a DialedNumber public field in its view model: public string DialedNumber { get { return _dialPadModel

updating model as user walks through wizard' steps

孤街浪徒 提交于 2020-01-15 11:43:30
问题 I'm going to use the SmartWizard jQuery plugin to create a wizard-like ASP.Net MVC application. The user will go through multiple steps to fill in data. [EDITED FOR CLARITY] Each step should be a Partial View. The ViewModel is common to all the Views: public class myViewModel { [Required] public int BM { get; set; } [Required] public int Cylindre { get; set; } } The first Partial View should show the field BM (of course I've simplified things here for clarity): @model MvcApplication3.Models

updating model as user walks through wizard' steps

半城伤御伤魂 提交于 2020-01-15 11:43:17
问题 I'm going to use the SmartWizard jQuery plugin to create a wizard-like ASP.Net MVC application. The user will go through multiple steps to fill in data. [EDITED FOR CLARITY] Each step should be a Partial View. The ViewModel is common to all the Views: public class myViewModel { [Required] public int BM { get; set; } [Required] public int Cylindre { get; set; } } The first Partial View should show the field BM (of course I've simplified things here for clarity): @model MvcApplication3.Models

Inject views into ItemsControl depending on object type

◇◆丶佛笑我妖孽 提交于 2020-01-13 14:58:27
问题 I have a service returning an array of type Party. Party has two subtypes, Person and Organization. I’m consuming this service in my WPF application (Prism, MVVM) from a view model. In the constructor of this view model I populate an observable collection of type Party: public PhoneBookViewModel(IPhoneBookService phoneBookProxy) { _phoneBookProxy = phoneBookProxy; var parties = _phoneBookProxy.GetAllParties(); _parties = new ObservableCollection<Party>(parties.ToList()); } So far so good. In

How to observe changes in database in order to update LiveData

半世苍凉 提交于 2020-01-13 13:36:09
问题 I am migrating an app from a LoaderManager with Callbacks to an implementation using ViewModel and LiveData . I would like to keep using the existing SQLiteDatabase . The main implementation works OK. The Activity instantiates the ViewModel and creates an Observer which updates the View if it observes changes in the MutableLiveData that lives in the ViewModel . The ViewModel gets it data (cursor) from the SQLiteDatabase through a query using a ContentProvider . But I have other activities

Kotlin dagger 2 Android ViewModel injection error

穿精又带淫゛_ 提交于 2020-01-12 10:12:02
问题 I'm trying to use dagger 2 on my Android application to inject the new ViewModel from arch android library. From what I see on this sample https://github.com/googlesamples/android-architecture-components/tree/e33782ba54ebe87f7e21e03542230695bc893818/GithubBrowserSample I need to use this: @MustBeDocumented @Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) @Retention(AnnotationRetention.RUNTIME) @MapKey internal

Kotlin dagger 2 Android ViewModel injection error

余生颓废 提交于 2020-01-12 10:10:31
问题 I'm trying to use dagger 2 on my Android application to inject the new ViewModel from arch android library. From what I see on this sample https://github.com/googlesamples/android-architecture-components/tree/e33782ba54ebe87f7e21e03542230695bc893818/GithubBrowserSample I need to use this: @MustBeDocumented @Target(AnnotationTarget.FUNCTION, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) @Retention(AnnotationRetention.RUNTIME) @MapKey internal

ViewModels with SelectList Design Decison

女生的网名这么多〃 提交于 2020-01-12 09:15:55
问题 I have created a viewmodel public VMPosition { public VMPosition(){}//for model binder public VMPosition(int EmployeeID) { PositionStatusList = new SelectList(_repo.getStatuses); //populate other properties } public int CurrentPositionID { get; set; } public int EmployeeID { get; set; } public int CurrentPositionHistoryID { get; set; } public bool AddingNew { get; set; } public bool ClosingCurrent { get; set; } public string CurrentPosition { get; set; } public DateTime

ViewModels with SelectList Design Decison

社会主义新天地 提交于 2020-01-12 09:15:35
问题 I have created a viewmodel public VMPosition { public VMPosition(){}//for model binder public VMPosition(int EmployeeID) { PositionStatusList = new SelectList(_repo.getStatuses); //populate other properties } public int CurrentPositionID { get; set; } public int EmployeeID { get; set; } public int CurrentPositionHistoryID { get; set; } public bool AddingNew { get; set; } public bool ClosingCurrent { get; set; } public string CurrentPosition { get; set; } public DateTime

Can jQuery do a POST of a ViewModel to a Controller in ASP.NET MVC?

自闭症网瘾萝莉.ら 提交于 2020-01-10 14:15:16
问题 I have my Html Textboxes created so that they will be bound to a custom view model when posting back to the server. <%= Html.TextBox("CustomerFormViewModel.Email")%> This works great if it's a traditional POST. I can then receive it on the Controller side with something like this: [AcceptVerbs(HttpVerbs.Post)] public ActionResult AddCustomer(CustomersFormViewModel model) { //validate data, save customer, handle validation errors... } I want to know -- is it possible to do the POST via jQuery