mvvm-light

WPF Binding filtered ObservableCollection ICollectionView to Combobox

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 02:44:50
问题 I want to filter an ObservableCollection to a subset based on type (type AddPoint) and want it ordered ascending with no duplicates. My base class is ModelBase, w/ sub-classes AddPoint, Time, Repeat, etc... The ObservableCollection MotionSequenceCollection will be filled w/ those types in any order and some will be duplicates. I've tried several different times and shown them below in the ICollectionView Property that I 'pulled' from: Bind subset of collection. OBSERVABLE COLLECTION private

MVVM: Communication between the Model and ViewModels

与世无争的帅哥 提交于 2019-12-06 01:37:01
问题 I'm developing a WPF application using the MVVM pattern. I'm using MVVM Light library and I'm also trying to use a dependency injector (I'm considering Ninject and Unity). I've read a lot of blog articles and I'm quite confused about the "proper" way of making my classes communicate with each other. In particular, I don't know when to use Dependency Injection and when to rely on the mediator pattern. Lets consider an example. I have a ViewModel, lets call it DataViewModel, and the Data class

VS 2010: Can’t insert mvvm-light snippet using shortcut - incompatibility with resharper 5?

試著忘記壹切 提交于 2019-12-05 21:29:55
i recently installed some snippets that come with the mvvm-light framework i am using. And sure enought i checked via Tools > Code Snippet Manager and they are installed under "My Code Snippets". If i do insert Snipper (right click in code window) or CTRL K + CTRL X then i can search within all available snippets.... But i do believe its possible to just type the shortcut key (in this case it is mvvmlocatorproperty) and pressing tab inserts the snippet BUT when i type the shortcut key it is not recognizing anything... What am i doing wrong?? This is not an incompatibility with resharper 5? -

MVVM-Light Toolkit — How To Use PropertyChangedMessage

余生长醉 提交于 2019-12-05 20:50:59
Can someone please post a working example of the PropertyChangedMessage being used? The description from the GalaSoft site states: PropertyChangedMessage: Used to broadcast that a property changed in the sender. Fulfills the same purpose than the PropertyChanged event, but in a less tight way. However, this doesn't seem to work: private bool m_value = false; public bool Value { get { return m_value ; } set { m_value = value; Messenger.Default.Send(new PropertyChangedMessage<bool>(m_value, true, "Value")); } This is related with the MVVM Light Messenger. In your property definition yo use like

How can MVVM Light be used in a WPF User Control Library project?

☆樱花仙子☆ 提交于 2019-12-05 20:28:20
Specifically, I would like to know how the view model is to be bound to a user control. The examples I have been able to find so far are all WPF Application or WPF Browser Application projects. Even the templates in tool kit are for WPF Application or WPF Browser Application projects. I am using Visual Studio 2010. Chry Cheng Found the ff. in the comments of MVVM Light's site: http://blog.galasoft.ch/posts/2010/03/whats-new-in-mvvm-light-v3/ . Basically, in lieu of App.xaml, the view model locator is declared as a resource in the user control. The framework's creator himself has spoken so I

Mvvm Light and Visual C# Express?

安稳与你 提交于 2019-12-05 18:56:06
Does MVVM Light work with Visual C# Express? Can't seem to get any of the templates showing up. At this point, I do not support Visual C# express for MVVM Light templates. I only support express editions for the Windows Phone and for Windows 8 (Visual Studio 11 for WinRT). I will consider supporting Visual C# express in a further revision of the installer. Unfortunately supporting new versions of Visual Studio is quite a lot of work to update the MSI... Eric Spirau It's quite easy to take the templates and move them to the personal template directory and they appear in visual studio 2010

MVVM ViewModel lots of properties

孤街浪徒 提交于 2019-12-05 18:45:08
问题 I am new in MVVM and I am developping an application. I have a form view with a lot of property. About 50. I can not seperate these into usercontrol because I would break the mvvm principles. I can not seperate these into model, because these contains logic. PropertyChange, Error change and these would not be poco classes, and these are not the model. Would it be nice If I kept 60 property in a same viewmodel? Do I think it wrong? How would you organize these? 回答1: I can not seperate these

Commands stop being executed

梦想与她 提交于 2019-12-05 15:01:52
update changing to my own relay command helped. though rooting the Funcs didn't Hi guys I was making a small MVVM application. It is supposed to take a class full of Func<string> and display a list of buttons each executing a command containing a Func<string> and displaying their return values in another list. The program works fine at first but after a random amount of button presses it simply stops executing commands. The UI is still responsive. It is as if the binding broke. There are a bit too many classes so I attached the whole project in the following link http://www.megafileupload.com

MVVMLight— Passing a parameter to a ViewModel constructor?

泪湿孤枕 提交于 2019-12-05 12:55:38
Suppose I have a ListBox which is bound to a collection of Foo objects, and the selected Foo is displayed in a contentcontrol with the content template being a FooView . Is there a way that I can make it so that the FooView passes the selected Foo to the constructor of the FooViewModel which is it's datacontext via the ViewModelLocator ? Jake Berger MainViewModel /*INotifyPropertChanged property*/ public FooViewModel CurrentFooVM{ get{/*INPC code*/} private set{/*INPC code*/} } /*INotifyPropertChanged property*/ public Foo SelectedFoo{ get{/*INPC code*/} set{/*INPC code*/ CurrentFooVM = new

MVVMLight ViewModelLocator on a UserControl

荒凉一梦 提交于 2019-12-05 11:56:47
Is it possible to use the MVVMLight ViewModelLocator on a UserControl. I have added it to my user control in the same way as is done on the MainWindow, but i get an error/popup in VS2010 stating "Cannot find resource named 'Locator'. Resource names are case sensitive." Has anyone tried this? Code i have thus far is pretty much a standard MVVMLight WPF starter application... UserControl <UserControl x:Class="NavTest3.PersonControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org