viewmodel

IsSelected property of ViewModel bound to ListBox, Only FIRST item selection works?

本小妞迷上赌 提交于 2019-12-13 03:11:18
问题 I have a MeetingViewModelList bound to a DataGrid . Each MeetingViewModel has a DocumentViewModelList bound to a ListBox within the DataGrid`s DataGridTemplateColumn . The IsSelected property of the DocumentViewModel is bound to the ListBox`s Item property IsSelected. I get no binding errors in the output console. The delete document button in the DocumentViewModel checks in its CanExecute Method this: private bool CanDeleteDocument() { return _isSelected; } When I select the FIRST Item in

Push common ViewModel functionality into a base class?

孤人 提交于 2019-12-13 02:32:29
问题 I'm using MVVM with Prism and Silverlight. I have multiple different views of one model. As I am writing more views their ViewModels seem to duplicate a lot of common code related to handling this one model. Rather than repeating the same common code in all the VMs I am tempted to push it back into the model (which would probably mix concerns too much). Or maybe into some common ViewModel base class? Or perhaps my VMs need a 2nd level of "shared VM" between them and the model? This single

MVC NullReferenceException on @foreach (var item in Model)

和自甴很熟 提交于 2019-12-13 00:55:30
问题 I'm getting the below error, after reading through this What is a NullReferenceException, and how do I fix it? I understand what the error is but not how its being caused or how to fix it in my case, Can anyone explain why? Error: System.NullReferenceException: Object reference not set to an instance of an object. Error on line: @foreach (var item in Model) Controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web

Open ViewModel from Appdelegate

徘徊边缘 提交于 2019-12-13 00:24:05
问题 I am trying to open a specific view in my Xamarin.Ios-Project via a Web-Url. The url-scheme works fine and i also check the url in the AppDelegate class as shown below: [Register("AppDelegate")] public partial class AppDelegate : MvxApplicationDelegate { // other methods ... public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { if (url == null) return false; var uri = new Uri(url.ToString()); if(uri.Host.Equals("myscheme-host")) {

Does my POST edit action overwrite all fields in EF?

元气小坏坏 提交于 2019-12-12 22:17:38
问题 Say I have a database record with 7 fields and I just want to edit the contents of field 1. So I hit my GET EDIT action, it renders the strongly typed view with my viewmodel and I go ahead and update field 1. However, my POST action contains 'mapping' for all fields as below. So will entity framework 'overwrite' all 6 other fields in the underlying database with the unchanged value or will it only just change field 1? Just looking for further clarification after giving the previous related

Submit javascript dynamically added elements to controller method like Stackoverflow

北慕城南 提交于 2019-12-12 21:10:56
问题 Put it simply: I'd like to let the user to select some tags in JS and submit it to my controller. Here are my suggestions: Create a hidden input for every inserted tag with naming convention like: Tag123 (123 = this tag's unique identifier) and iterate through FormCollection in my action method to find out which tags have been selected. Cons are obvious: using FormCollection instead of ViewModel and iterating through the FormCollection to get my desired data seems bad to me. Create one hidden

ModelState validation checking multiple boolean property

我与影子孤独终老i 提交于 2019-12-12 20:35:36
问题 I have view model that have multiple boolean properties, in my controller i have checking ModelState.IsValid before proceeding to service layer. Now I want to make that ModelState.IsValid return false if none of boolean property set to true, is there a way to make it happen? Here is my sample class public class Role { public int Id {get; set;} [Required(ErrorMessage = "Please enter a role name")] public string Name {get; set;} public bool IsCreator {get; set;} public bool IsEditor {get; set;}

SilverLight - MVVM binding viewmodel property to datagrid column

廉价感情. 提交于 2019-12-12 20:29:22
问题 In my SilverLight application, I have a property in my ViewModel called 'vmProperty' and a list called 'dgSource'. I bind my dgSource to the datagrid as ItemsSource at which point each datagrid row's datacontext changes to each item in dgSource. One of the columns, say a checkbox column, needs to bind to vmProperty. But since the ViewModel is no longer the row's datacontext, I cannot get access to this property. How do I get around this problem? If the question is not clear, please let me

which is the best practices for exposing entity or DTO to view in mvc3?

怎甘沉沦 提交于 2019-12-12 20:26:42
问题 I have created my own customized lots of architecture including n-tier layers for different different technology. Currently working on n-tier architecture with asp.net mvc framework. The problem is I have entity framework at data access layer. As the entities will have all it's relational metadata and navigation properties, it becomes heavier one. I am feeling like it is not wise to expose this entities directly over mvc view. I am more favor in exposing own customized model of entities over

Show one child VM, then show another, after the first was closed

核能气质少年 提交于 2019-12-12 20:24:00
问题 I have one parent conductor. I want to show first view-model inside it. Then after first one is closed (i.e. some operation is done), I want to show a different view-model. I'm using Caliburn.Micro.Contrib, where a ConductResult displays child VM in a Conductor . It has a cool extension method AfterClosingDo , which runs a coroutine after that child was deactivated and closed. However, when I run another ConductResult using AfterClosingDo , basically this happens: first child VM is closed