viewmodel

Silverlight DataGrid.Celltemplate Binding to ViewModel

倾然丶 夕夏残阳落幕 提交于 2019-11-27 07:50:48
问题 I am in the process of implimenting the MVVC pattern and am having trouble binding a property in the viewmodel from within a DataTemplate within a datagrid. If I have a textblock outside the DataTemplate in the column it works fine (since I am directly referencing the datacontext of the UserConrol, i.e. the VM) however from within the DataTemplate it wont return the plain text property. It will however return a property from the iterated IEnumerable item. <UserControl xmlns:data="clr

MVVM ViewModel vs. MVC ViewModel

冷暖自知 提交于 2019-11-27 06:53:36
ViewModel is a term that is used in both MVVM (Model-View-ViewModel) and the recommended implementation for ASP.NET MVC. Researching "ViewModel" can be confusing given that each pattern uses the same term. What are the main differences between the MVC ViewModel and MVVM ViewModel? For example, I believe the MVVM ViewModel is more rich, given the lack of a Controller. Is this true? A rather challenging question to answer succinctly, but I'll attempt it. (Bear in mind that the answers to these kinds of questions are still the subject of debate amongst developers.) In MVC, the ViewModel provides

WPF - MVVM - Textbox getting out of sync with viewmodel property

☆樱花仙子☆ 提交于 2019-11-27 06:02:01
问题 I have a WPF view with a TextBox, binding the Text field to a ViewModel with UpdateSourceTrigger set to PropertyChanged. In the property setter in the ViewModel, I have a simple check to prevent the text from exceeding 10 characters: <TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" /> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.DataContext = new MainViewModel(); } } public string Name { get { return _Name; } set

WPF MVVM communication between View Model

南笙酒味 提交于 2019-11-27 05:42:24
问题 I am working on WPF MVVM application wherein I have 2 views View1 and View2 with their respective ViewModels. Now, I want on click of a button in View1 would close View1 and open View2 using ViewModel1. Also, I want to pass some data say a instance of person class to ViewModel2 when opening from ViewModel1 which would be used to display information in View2. What is the best and possibly the simplest way to achieve this inside ViewModels only, I would want to avoid writing code for navigation

ValidateInput(false) vs AllowHtml

守給你的承諾、 提交于 2019-11-27 05:18:31
问题 I have a form that is used to create a memo, to do that I am using a rich text editor to provide some styling, this creates html tags in order to apply style. When I post that text, the mvc throws an error to prevent potentially dangerous scripts, so I have to specifically allow it. I have found 2 ways of doing this, one is to decorate the controller method with [ValidateInput(false)] and the other is to decorate the ViewModel attribute with [AllowHtml] . To me, [AllowHtml] looks much nicer,

How to update LiveData of a ViewModel from background service and Update UI

筅森魡賤 提交于 2019-11-27 05:11:16
问题 Recently I am exploring Android Architecture, that has been introduced recently by google. From the Documentation I have found this: public class MyViewModel extends ViewModel { private MutableLiveData<List<User>> users; public LiveData<List<User>> getUsers() { if (users == null) { users = new MutableLiveData<List<Users>>(); loadUsers(); } return users; } private void loadUsers() { // do async operation to fetch users } } the activity can access this list as follows: public class MyActivity

what is difference between a Model and an Entity

旧街凉风 提交于 2019-11-27 05:08:04
问题 I am confused to understand what is the meaning of this words: Entity , Model , DataModel , ViewModel Can any body help me to understanding them please? Thank you all. 回答1: I hope I've not missed your point here king.net... Anyway, presuming you're talking about entity modelling or entity-relationship modelling (ERDs): an entity represents any real world entity - e.g. student, course, an entity will have attributes - e.g. student has first name, surname, date-of-birth an entity will have

Passing complex navigation parameters with MvvmCross ShowViewModel

戏子无情 提交于 2019-11-27 04:32:04
My complex type wouldn't pass from Show to Init method even with configured MvxJsonNavigationSerializer as specified here Custom types in Navigation parameters in v3 public class A { public string String1 {get;set;} public string String2 {get;set;} public B ComplexObject1 {get;set;} } public class B { public double Double1 {get;set;} public double Double2 {get;set;} } When I pass instance of object A to ShowViewModel method I receive this object with String1 & String2 deserialized correctly but CopmlexObject1 is null. How to deal with complex object MvvmCross serialization? I believe there may

When do I use View Models, Partials, Templates and handle child bindings with MVC 3

╄→гoц情女王★ 提交于 2019-11-27 04:17:25
new to mvc3, i have a few questions, would appreciate if someone could answer/provide links: When should I use View Models? Is it not recommended to use the domain? I find that my view models are copies of my domain objects, and don't see the value... When should I use Partials? Is it only if the partial view will be reused? When should I use Display Templates and Editor Templates? Can I use these without a view model? How do I create an edit screen where the parent and list of child objects are both editable? i.e. a few fields at the top (parent) and a grid of fields below (like editable rows

How to map View Model back to Domain Model in a POST action?

柔情痞子 提交于 2019-11-27 04:09:06
问题 Every article found in the Internet on using ViewModels and utilizing Automapper gives the guidelines of the "Controller -> View" direction mapping. You take a domain model along with all Select Lists into one specialized ViewModel and pass it to the view. That's clear and fine. The view has a form, and eventually we are in the POST action. Here all the Model Binders come to the scene along with [obviously] another View Model which is [obviously] related to the original ViewModel at least in