c# Programming Glossary: viewmodel
Set focus on textbox in WPF from view model (C#) & wPF http://stackoverflow.com/questions/1356045/set-focus-on-textbox-in-wpf-from-view-model-c-wpf it's not a good idea to have any reference to UI in your ViewModel. You can ask Why but this is another question to post on Stackoverflow.. Finally general approach that I use to set focus from ViewModel is Attached Properties. I wrote very simple attached property.. which can be set on any UIElement. And it can be bound to ViewModel's property IsFocused for example. Here it is public static class..
How to bind to a PasswordBox in MVVM http://stackoverflow.com/questions/1483892/how-to-bind-to-a-passwordbox-in-mvvm the password. I basically have properties in my LoginViewModel for Username and Password . Username is fine and is working.. and Binding Path Password then the property in my LoginViewModel was updated. My code is very simple basically I have a Command.. Width 130 I have my TextBox this is no problem but in my ViewModel the Password is empty. Am I doing something wrong or missing..
Good or bad practice for Dialogs in wpf with MVVM? http://stackoverflow.com/questions/3801681/good-or-bad-practice-for-dialogs-in-wpf-with-mvvm like this. I mostly use viewmodel first approach with mvvm ViewModel which calls a dialog window var result this.uiDialogService.ShowDialog.. app.xaml or something DataTemplate DataType x Type DialogViewModel EditOrNewAuswahlItemVM DialogView EditOrNewAuswahlItem DataTemplate..
WPF MVVM Newbie - how should the ViewModel close the form? http://stackoverflow.com/questions/501886/wpf-mvvm-newbie-how-should-the-viewmodel-close-the-form MVVM Newbie how should the ViewModel close the form I'm trying to learn WPF and the MVVM problem.. Login form written using the MVVM pattern. This form has a ViewModel which holds the Username and Password which are bound to the.. When the Login command fires it invokes a function in the ViewModel which goes off and sends data over the network to log in. When..
Binding WPF ComboBox to a Custom List http://stackoverflow.com/questions/561166/binding-wpf-combobox-to-a-custom-list The ComboBox ItemsSource is bound to a property on a ViewModel class that lists a bunch of RAS phonebook entries as a CollectionView.. SelectedItem or SelectedValue to another property of the ViewModel. I have added a MessageBox into the save command to debug the.. SelectedItem SelectedValue binding is not being set. The ViewModel class looks something like this public ConnectionViewModel private..
Is it possible to bind a Canvas's Children property in XAML? http://stackoverflow.com/questions/889825/is-it-possible-to-bind-a-canvass-children-property-in-xaml UserControl_Loaded object sender RoutedEventArgs e DesignerViewModel dvm this.DataContext as DesignerViewModel dvm.Document.Items.CollectionChanged.. e DesignerViewModel dvm this.DataContext as DesignerViewModel dvm.Document.Items.CollectionChanged new System.Collections.Specialized.NotifyCollectionChangedEventHandler.. my current approach because it mucks up my nice Model View ViewModel by making the View aware of it's ViewModel. c# wpf data binding..
Using the WPF Dispatcher in unit tests http://stackoverflow.com/questions/1106881/using-the-wpf-dispatcher-in-unit-tests user DispatcherPriority.Normal null I have this code in my viewmodel base class to get a Dispatcher if Application.Current null this.Dispatcher..
Give some command to View in MVVM http://stackoverflow.com/questions/15465161/give-some-command-to-view-in-mvvm
The best approach to create new window in WPF using MVVM http://stackoverflow.com/questions/2108949/the-best-approach-to-create-new-window-in-wpf-using-mvvm questions 501886 wpf mvvm newbie how should the viewmodel close the form 2100824#2100824 I've posted my vision how to..
How to have multiple pairs “View-ViewModel”? http://stackoverflow.com/questions/2830517/how-to-have-multiple-pairs-view-viewmodel hold of the view retrieve its key and then retrieve the viewmodel from the locator. Update Often you don't even need to track.. Update Often you don't even need to track multiple viewmodels. For instance you can have the Messenger class send a message.. Messenger class send a message to all instances of a given viewmodel class using the Send overload. So before implementing a dictionary..
A super-simple MVVM-Light WP7 sample? http://stackoverflow.com/questions/3655422/a-super-simple-mvvm-light-wp7-sample http csharperimage.jeremylikness.com 2010 04 model view viewmodel mvvm explained.html Here's the sample for the benefit of others..
Good or bad practice for Dialogs in wpf with MVVM? http://stackoverflow.com/questions/3801681/good-or-bad-practice-for-dialogs-in-wpf-with-mvvm to do in my code was something like this. I mostly use viewmodel first approach with mvvm ViewModel which calls a dialog window.. in code. That's why I created an interface for my dialogviewmodel to implement. public interface IDialogResultVMHelper event EventHandler.. event EventHandler DialogResultTrueEvent Whenever my viewmodel think its time for dialogresult true then raise this event...
C# mvc 3 using selectlist with selected value in view http://stackoverflow.com/questions/4579598/c-sharp-mvc-3-using-selectlist-with-selected-value-in-view a blo from whe applications managements system. In my viewmodel i've got the following property defined for a list of selectlistitems.. So at this point everything seems to be okay. The viewmodel is filled entirely correct. Then in my view i'm using Razor.. lost it's selection. How can this be Until the point the viewmodel is being returned with the view everything is okay. But when..
Using view models in ASP.NET MVC 3 http://stackoverflow.com/questions/5306655/using-view-models-in-asp-net-mvc-3 dynamic causes a problem in expressions. c# asp.net mvc 3 viewmodel automapper share improve this question After some trial..
Changing the View for a ViewModel http://stackoverflow.com/questions/5309099/changing-the-view-for-a-viewmodel mt WPF application. In order to connect the view to the viewmodels I use a ResourceDictionary used in Application.Resources that.. that looks like DataTemplate DataType x Type viewmodel SampleViewModel view SampleView1 DataTemplate The view models.. Inside the handler of the command I change the type of viewmodel and update the property ItemViewModel in a tricky way because..
How can I bind nested ViewModels from View to Controller in MVC3? http://stackoverflow.com/questions/5700558/how-can-i-bind-nested-viewmodels-from-view-to-controller-in-mvc3 everybody for your answers. c# asp.net mvc 3 binding viewmodel share improve this question Don't write loops in a view...
MVC 3 form post and persisting model data http://stackoverflow.com/questions/5849398/mvc-3-form-post-and-persisting-model-data provider but I'd prefer not to. c# asp.net mvc forms viewmodel share improve this question You can add your current SearchModel..
WPF MVVM Modal Overlay Dialog only over a View (not Window) http://stackoverflow.com/questions/6351612/wpf-mvvm-modal-overlay-dialog-only-over-a-view-not-window What I want to achieve is Have a reusable View usercontrol viewmodel to bind to to be able to use inside other views as a modal overlay.. dialog over the it. How I wanted to implement it create a viewmodel that takes string message and action string collection buttons.. takes string message and action string collection buttons viewmodel creates a collection of ICommands that call those actions dialog..
Bind datagrid column visibility MVVM http://stackoverflow.com/questions/7711275/bind-datagrid-column-visibility-mvvm not complain it seems that the resource i found but the viewmodel property is newer called. This is the entire DG tk DataGrid..
Return column based on record in FK table http://stackoverflow.com/questions/15536154/return-column-based-on-record-in-fk-table BrowseVendors IQueryable BrowseVendorModel viewModel _db.VendorProfiles .Include VendorsSelected .Select s new BrowseVendorModel.. .OrderBy v v.ProfileID return viewModel c# linq entity framework linq to entities entity framework.. BrowseVendors IQueryable BrowseVendorModel viewModel _db.VendorProfiles .Include VendorsSelected .Select s new BrowseVendorModel..
MVC 4 Edit modal form using Bootstrap http://stackoverflow.com/questions/16011151/mvc-4-edit-modal-form-using-bootstrap the modal public ActionResult EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial.. EditPerson int id var viewModel new EditPersonViewModel viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost.. viewModel.Id id return PartialView _EditPersonPartial viewModel HttpPost this action takes the viewModel from the modal public..
MVC 4 - Many-to-Many relation and checkboxes http://stackoverflow.com/questions/16383494/mvc-4-many-to-many-relation-and-checkboxes initialize the view model public ActionResult Create var viewModel new SubscriptionCreateViewModel Companies _context.Companies.. Name c.Name IsSelected false .ToList return View viewModel Now you have a strongly typed view for this action @model SubscriptionCreateViewModel.. public ActionResult Create SubscriptionCreateViewModel viewModel if ModelState.IsValid var subscription new Subscription Amount..
C# - copying property values from one instance to another, different classes http://stackoverflow.com/questions/3610891/c-sharp-copying-property-values-from-one-instance-to-another-different-classe defect.GetType .GetProperties IEnumerable string viewModelPropertyNames defectViewModel.GetType .GetProperties .Select.. propertiesToCopy defectProperties.Where defectProperty viewModelPropertyNames.Contains defectProperty.Name foreach PropertyInfo.. Object does not match target type defectProperty.SetValue viewModel defectValue null What would be the best way to do this Should..
C# mvc 3 using selectlist with selected value in view http://stackoverflow.com/questions/4579598/c-sharp-mvc-3-using-selectlist-with-selected-value-in-view Text Messages.SelectAnItem Value Messages.SelectAnItem var viewModel new BlogModel BlogId blogToEdit.Id Active blogToEdit.Actief.. Id Naam blogToEdit.CategorieId return View viewModel When i set a breakpoint just before the view is being returned.. SelectListItem Text x.Name Value x.Id.ToString .ToList var viewModel new BlogModel BlogId blogToEdit.Id Active blogToEdit.Actief..
WPF Binding UI events to commands in ViewModel http://stackoverflow.com/questions/4897775/wpf-binding-ui-events-to-commands-in-viewmodel move a SelectionChanged event out of my code behind to the viewModel I ™ve looked at some examples of binding elements to commands..
Big smart ViewModels, dumb Views, and any model, the best MVVM approach? http://stackoverflow.com/questions/857820/big-smart-viewmodels-dumb-views-and-any-model-the-best-mvvm-approach Customer model CustomerViewModel viewModel viewModel.FirstName model.FirstName viewModel.LastName model.LastName.. Customer model CustomerViewModel viewModel viewModel.FirstName model.FirstName viewModel.LastName model.LastName.. viewModel viewModel.FirstName model.FirstName viewModel.LastName model.LastName viewModel.TimeOfMostRecentActivity model.TimeOfMostRecentActivity..
|