viewmodel

ViewModels or ViewBag?

折月煮酒 提交于 2020-01-08 21:52:29
问题 I'm fairly new to MVC4, EF5 and ASP.Net, and I don't seem to be able to find a good answer anywhere. Basically, Should everything be done through the viewmodel or is it Ok to also incorporate viewbag? Say I have a method which populates a drop down list, and I am using a viewmodel to represent the output for the view. Am I ok to use Viewbag.DropDown = PopulateDropdown(); or would it be better to incorporate this into the ViewModel, by creating a property to hold the List<SelectListItem>

ViewModels or ViewBag?

心不动则不痛 提交于 2020-01-08 21:51:27
问题 I'm fairly new to MVC4, EF5 and ASP.Net, and I don't seem to be able to find a good answer anywhere. Basically, Should everything be done through the viewmodel or is it Ok to also incorporate viewbag? Say I have a method which populates a drop down list, and I am using a viewmodel to represent the output for the view. Am I ok to use Viewbag.DropDown = PopulateDropdown(); or would it be better to incorporate this into the ViewModel, by creating a property to hold the List<SelectListItem>

ViewModels or ViewBag?

泄露秘密 提交于 2020-01-08 21:51:16
问题 I'm fairly new to MVC4, EF5 and ASP.Net, and I don't seem to be able to find a good answer anywhere. Basically, Should everything be done through the viewmodel or is it Ok to also incorporate viewbag? Say I have a method which populates a drop down list, and I am using a viewmodel to represent the output for the view. Am I ok to use Viewbag.DropDown = PopulateDropdown(); or would it be better to incorporate this into the ViewModel, by creating a property to hold the List<SelectListItem>

UWP - How to bind a ContentPresenter's element to the main ViewModel?

纵然是瞬间 提交于 2020-01-07 02:18:34
问题 I work on an app where the user can edit a "big" form: The form contains a lot of fields: it is displayed in a Pivot , where each PivotItem represents a category of the form. Some categories contain one or more child items: they are displayed through a Master-Detail presentation. To display the items of the Detail part, I use a ContentPresenter that is binded directly to the Model: <ContentPresenter x:Name="DetailContentPresenter" Grid.Column="1" Grid.RowSpan="2" BorderThickness="1,0,0,0"

Does the Business Logic Layer handle View Models in MVC?

删除回忆录丶 提交于 2020-01-06 22:28:08
问题 I have an application with 4 projects Presentation BLL Models DA Should the BLL be passing and retrieving View Models to and from the Presentation Layer. (And handle all mapping) Or rather should it only deal with Domain Models and let the Presentation Layer (Controller) handle all mappings. Thanks 回答1: There is nothing absolute about your development approach. you could choose what suits you in any case. But you should consider your future maintenance and extension possibilities when you

How does View Model Binding work? + Best way of handing dynamic controls with view models?

可紊 提交于 2020-01-06 13:31:10
问题 I am using asp.net mvc 3 and thinking what the best way to handle this scenario is. Say I have a form that creates a reward structure. In this case their can be many levels of rewards example $100 to $500 - get .05% back $501 to $1000 - get 0.6% back $1001 to $1001 - get 0.7% back and so forth. Now these tiers are entered in the form I am creating. There could be one reward tier or there could be 5 tiers or 50 tiers. I just don't know. Option 1 Make an artificial limitation of say 5 tiers. If

How does View Model Binding work? + Best way of handing dynamic controls with view models?

牧云@^-^@ 提交于 2020-01-06 13:30:40
问题 I am using asp.net mvc 3 and thinking what the best way to handle this scenario is. Say I have a form that creates a reward structure. In this case their can be many levels of rewards example $100 to $500 - get .05% back $501 to $1000 - get 0.6% back $1001 to $1001 - get 0.7% back and so forth. Now these tiers are entered in the form I am creating. There could be one reward tier or there could be 5 tiers or 50 tiers. I just don't know. Option 1 Make an artificial limitation of say 5 tiers. If

Trigger update for a LiveData member when another LiveData is updated in the view model

南楼画角 提交于 2020-01-06 02:29:30
问题 In a word game app I share a model between an activity and a fragment: public class MainViewModel extends AndroidViewModel { private LiveData<List<Game>> mGames; private final MutableLiveData<Game> mDisplayedGame = new MutableLiveData<>(); (please excuse the non-english text in the screenshot) The activity observes mGames being currently played by the user and updates the navigational drawer menu (see the left side of the above screenshot). The fragment observes mDisplayedGame and displays it

How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 02:23:45
问题 I have a WPFToolkit-datagrid and a View-model class with a property - "SelectedGridItems" How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property ("SelectedGridItems") ? 回答1: Here is an attached property that hooks to the SelectionChanged event of the ListBox and populates a list of selected items to the ViewModel. You can simply change "ListBox" to "DataGrid". http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/ Edit: Adding source

How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property?

╄→尐↘猪︶ㄣ 提交于 2020-01-06 02:23:27
问题 I have a WPFToolkit-datagrid and a View-model class with a property - "SelectedGridItems" How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property ("SelectedGridItems") ? 回答1: Here is an attached property that hooks to the SelectionChanged event of the ListBox and populates a list of selected items to the ViewModel. You can simply change "ListBox" to "DataGrid". http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/ Edit: Adding source