mvvm-light

state handling in windows 8 using mvvmlight

元气小坏坏 提交于 2019-12-06 07:49:39
Implementation of state handling in windows 8 using mvvmlight Is there any method avilable in mvvmligt to manage states in WinRT? How I can duplicate the functionality of default Suspensionmanager by using WinRT? And the second one is about managing navigation cycle ie if I navigated from page A - > B. and the go for suspend and shutdown state. When I re start the application in need to open page B. and while presses back key I need to load A. How I can effectively implement this using MVVM light in my WinRT application? I wrote this originally for WP7 and have been updating for Win8 RT. It

Should I choose MvvmLight or MvvmCross on a new project of simple to medium complexity? [closed]

那年仲夏 提交于 2019-12-06 07:28:13
Closed . This question is opinion-based . It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 5 years ago . I am trying to find the main difference between MVVMlight and MVVMCrossthose frameworks. I am planning to develop for Android and Windows Phone. I will use the Xamarin framework. (and Xamarin.Forms) The project should be a vehicle tracking application that talks to Azure-run server. The app itself will be (as usual in the beginning of a project) very simple (start, stop,

Why WeakReferences in RelayCommand?

为君一笑 提交于 2019-12-06 07:24:18
问题 I recently upgraded from MVVMLight 3 to 4, and noticed that my Commands broke. It turns out that the use of weak references in the new RelayCommand (implemented in version 3.5) were causing a code construct that I am using to fail. I know that there is some argument for weak refs relating to memory leak, I just don't understand it. This fails: private void InitCommand() { Command = new SwitchMainGridCommand<SwitchMainGridToolViewModel>(this).Command; } By fails, I mean that when I go to use

When and where to unregister messenger with mvvmlight

六眼飞鱼酱① 提交于 2019-12-06 06:23:06
问题 I build a project with mvvmlight. Using Messenger send message between VMs or VM and View. Now, I wonder that when and where to unregister messenger. Could u help me? Edited: This is my scene: There are a MainWindow and a ChildWindow, the ChildWindow (include a ContentControl consist of one of two different UserControl), change the ContenControl via a SwitchButton in ChildWindow. Every window or UserControl corresponding to a ViewModel. MainViewModel sends a message to MainWindow to open the

One Model Entity, Multiple Pages -> Multiple Views? Multiple ViewModels?

≯℡__Kan透↙ 提交于 2019-12-06 06:02:27
Due to limited screen real estate I will be capturing user input for a single entity using multiple pages (displayed consecutively - think wizard). In my model I expect it is correct to model this entity as a single class. In an MVVM implementation I am assuming it is best MVVM practice to consider each page as a seperate View. Is this correct? Is there a consensus on the best MVVM practice for whether each Page has it's own ViewModel or should there be one ViewModel instance that is referenced by the multiple Pages? To illustrate: Option 1 Class A (X, Y, Z) ViewModelA1 (X) ViewModelA2 (Y)

Proper way in MVVM to drive visual states

こ雲淡風輕ζ 提交于 2019-12-06 04:49:23
Given a content presenter that can display one of 4 different application pages, and I want to fade/otherwise animate a transition between pages based on view model state. Ideally I'd like to have these all defined within a DataTemplate, and then trigger transitions based on an enum from the view model, so that when some enum representing state changes, the transitions trigger to the appropriate page. Is there a known best practice to handle things like this? Immediately coming to mind is the possibiltiy to use Enter and Exit actions on data triggers to play storyboards, but this definately

MVVM Light - Relaycommand with Pushpins

拟墨画扇 提交于 2019-12-06 04:43:36
I am data binding some pushpins to a MapLayer. They display fine, but when I use the relaycommand to pass the eventargs from the mouse leftbuttonUp, the object sources is an elipse. I have used this method on a MapPolygon and picked up the information I wanted from the object. Maybe I am aproaching this badly as I am new to mvvm, so please let me know! This works for my MapPolygons (vm references the namespace of my extendedMapPolygon class) <DataTemplate x:Name="polyTemplate"> <vm:extendedMapPolygon cName="{Binding _cName}" Locations="{Binding _Locations}" /> </DataTemplate> Here is the XAML

ViewModel doesn't receive message in MVVM Light

倖福魔咒の 提交于 2019-12-06 04:36:48
I have two ViewModels: MainViewModel and QuestionViewModel. I Register they in ViewModelLocator. SimpleIoc.Default.Register<MainViewModel>(); SimpleIoc.Default.Register<QuestionViewModel>(); On MainViewModel I have a ListBox with Questions. When Click I execute this command NavigationService.NavigateTo(new Uri("/Pages/QuestionPage.xaml", UriKind.Relative)); Messenger.Default.Send<Question, QuestionViewModel>(q); QuestionPage's DataContext set to QuestionViewModel. On QuestionViewModel I register message: Messenger.Default.Register<Question>(this, q => { MessageBox.Show("!"); }); But this

MVVMLight - how to get a reference to the ViewModel in the View?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 03:33:30
问题 I'm building a Windows Phone 7 app, and I need a reference to my ViewModel in my view so I can set a property from my event handler. The only problem is that I'm not able to get that reference. What I did; I have a ViewModelLocator (deleted the irrelevant bits): static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); SimpleIoc.Default.Register<TunerViewModel>(); } [SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "This non

How to reset all instances in IOC Container

你离开我真会死。 提交于 2019-12-06 03:09:14
问题 I have made an C# WPF Application using the MVVM Light framework. My Application uses the ViewModelLocator class to locate the viewmodels during runtime. The ViewModelLocator makes usage of the SimpleIoc class which also comes with the MVVM Light framework. Here is my scenario: The user logs in an can use my application. On logout, i want to dispose/reset/recreate all viewmodel instances to provide a clean environment to the next user. I tried to implement the Cleanup() method in the