mvvm-light

Handling user settings with MVVM

依然范特西╮ 提交于 2019-12-22 05:33:12
问题 Currently i'm developing an WPF application with the MVVM-light framework. On this moment i'm setting my settings as shown in the next example code in my viewmodel: private string _property public string Property { get { return _property; } set { if (_property != value) { _property = value; Settings.Default.Property = value; RaisePropertyChanged("Property"); } } } I save my settings on application exit: protected override void OnExit(ExitEventArgs e) { Settings.Default.Save(); } Everything

EventToCommand Missing For Windows Phone App

走远了吗. 提交于 2019-12-22 05:11:59
问题 I'm building Windows Phone 8 app using MVVM Light. So far, so good. However, when I used EventToCommand, I get multiple errors. One similar question is here EventToCommand not working when migrate to v4 for SL5, but sadly it doesn't solve my problem.! It automatically adds following reference: xmlns:command1="http://www.galasoft.ch/mvvmlight" Errors that I receive: The name "EventToCommand" does not exist in the namespace "clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight

EventToCommand for Loaded event not working as expected if Window.SizeToContent = WidthAndHeight

帅比萌擦擦* 提交于 2019-12-22 05:06:00
问题 I find out that the EventToCommand for the Loaded-event is not working as expected if the Window.SizeToContent attribute is set to WidthAndHeight . The Loaded-event seems to be fired correctly, but the EventToCommand.Command property is bound AFTER the Loaded event is fired. If SizeToContent is Manual the Command will be bound BEFORE Loaded is fired and it works as expected. Does anyone also have problems with this behavior and/or an explanation for this? My workaround for now is to bind to

UWP: How to catch the click of a listview part from another listview in the viewmodel instead of code-behind?

江枫思渺然 提交于 2019-12-21 21:38:24
问题 I have this listview: <Page x:Class="DataBase.ControlsPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding CustomersViewModel, Source={StaticResource ViewModelLocator}}"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <ListView Name="HeaderList" ItemsSource="{Binding Customers}"> <ListView.ItemTemplate> <DataTemplate> <Grid> <Border Background="Bisque"> <TextBlock Text="

How to handle the back button on WP 8.1 using MVVM light?

与世无争的帅哥 提交于 2019-12-21 20:29:40
问题 I'm searching for the appropiate way to handle the back button pressed event on Windows Phone 8.1 WinRT using the NavigationService available on MVVM light 5. So far I think the best place to do it is inside the ViewModelLocator by registering the GoBack method of the NavigationService while creating it following the approach outlined in NavigationService in MVVM Light V5 This is an effective approach. However, I can't handle validation before navigating back so I was wondering if there is a

How to handle the back button on WP 8.1 using MVVM light?

家住魔仙堡 提交于 2019-12-21 20:29:21
问题 I'm searching for the appropiate way to handle the back button pressed event on Windows Phone 8.1 WinRT using the NavigationService available on MVVM light 5. So far I think the best place to do it is inside the ViewModelLocator by registering the GoBack method of the NavigationService while creating it following the approach outlined in NavigationService in MVVM Light V5 This is an effective approach. However, I can't handle validation before navigating back so I was wondering if there is a

Silverlight 4 + MVVM + KeyDown event

蓝咒 提交于 2019-12-21 16:33:52
问题 I'm trying to build a sample game in Silverlight 4 using the MVVM design pattern to broaden my knowledge. I'm using Laurent Bugnion's MvvmLight toolkit as well (found here: http://mvvmlight.codeplex.com/ ). All I want to do right now is move a shape around within a Canvas by pressing specific keys. My solution contains a Player.xaml (just a rectangle; this will be moved around) and MainPage.xaml (the Canvas and an instance of the Player control). To my understanding, Silverlight doesn't

Silverlight 4 + MVVM + KeyDown event

非 Y 不嫁゛ 提交于 2019-12-21 16:33:46
问题 I'm trying to build a sample game in Silverlight 4 using the MVVM design pattern to broaden my knowledge. I'm using Laurent Bugnion's MvvmLight toolkit as well (found here: http://mvvmlight.codeplex.com/ ). All I want to do right now is move a shape around within a Canvas by pressing specific keys. My solution contains a Player.xaml (just a rectangle; this will be moved around) and MainPage.xaml (the Canvas and an instance of the Player control). To my understanding, Silverlight doesn't

Missing EventToCommand behaviour in mvvmlight for Windows 8 - Work Around?

孤者浪人 提交于 2019-12-21 04:38:07
问题 Question says it all really :) I'm writing a Windows 8 app in XAML/C# using MVVM Light and I've noticed the EventToCommand feature hasn't been implemented yet. Are there any work arounds for this that anybody can suggest? thanks! 回答1: Check out the EventToCommand behavior written by LocalJoost which uses Reactive Extensions: http://dotnetbyexample.blogspot.be/2012/07/a-winrt-behavior-to-mimic-eventtocommand.html 回答2: You can now accomplish what EventToCommand used to do using the Behaviors

CommandManager.InvalidateRequerySuggested does not cause a requery on CanExecute in MVVM-Light

青春壹個敷衍的年華 提交于 2019-12-21 04:14:08
问题 I am using MVVM-Light RelayCommand private ICommand myRevertCmd; public ICommand Revert { get { if (myRevertCmd == null) { myRevertCmd = new RelayCommand(RevertExecute, CanRevertExecute); } return myRevertCmd; } } private void RevertExecute() { searchType = SearchType.Revert; SearchStart(); } private bool CanRevertExecute() { return isRevertEnabled; } I have some code that changes the value of isRevertEnabled but the linked button does not change. After some searching I found that you can use