mvvm-light

How to implement IsEnabledChanged of silverlight dataform using MVVM

北战南征 提交于 2019-12-02 08:35:21
I am looking for an example of how to implement the property IsEnabledChanged of the dataform using MVVM light, I set up the triggers but not sure about the implementation. So, here is the code behind version: void DataForm_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { if (!IsEnabled) { VisualStateManager.GoToState(DataForm, "Disabled", true); } else { VisualStateManager.GoToState(DataForm, "Normal", true); } } DataForm.IsEnabledChanged += new DependencyPropertyChangedEventHandler(DataForm_IsEnabledChanged); in xaml using MVVM light I did this: <i:EventTrigger

MVVM messaging or events or what other option out therer?

一个人想着一个人 提交于 2019-12-02 07:36:00
I have a menu in MainViewModel, now on selection of a particular menuItem I wanted to update data of a view which is already loaded. i.e. although there's an instance of that viewModel in MainViewModel, when I try to invoke the method thru that instance and change the data property, it doesnt show the changes in the view. Whereas same changes occur when I invoke that method through relay command using a button on that viewModel's view. Now its like I need to invoke relay command of that viewModel from MainViewModel, I guess that will fix the problem, but how to do that? what's easiest way.

MVVM Light Toolkit throws an System.IO.FileLoadException

妖精的绣舞 提交于 2019-12-02 07:02:22
I'm running VS 2010 along with Expression Blend 4 beta. I created a MVVM Light project from the supplied templates and I get a System.IO.FileLoadException when I try to view the MainWindow.Xaml in VS 2010 designer window. The template already references System.Windows.Interactivity. Here are the details of the exception: System.IO.FileLoadException Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) at System.Reflection

Dynamically add eventtocommand actions to a listbox

空扰寡人 提交于 2019-12-02 06:45:43
问题 I have a page with namespaces: xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xaml at design time: <ListBox x:Name="ItemGroupsList" ItemsSource="{Binding ItemGroups}" Height="496" SelectedItem="{Binding SelectedItemGroup, Mode=TwoWay}" > <Custom:Interaction.Triggers> <Custom:EventTrigger EventName="SelectionChanged"> <GalaSoft

Hook Up Command for BackKeyPress in XAML

风流意气都作罢 提交于 2019-12-02 05:28:24
Is there a way to hook up the BackKeyPressed event to a command in a view (XAML)? I'm using MVVM Light. I have a few login/signup screens that can possibly be shown. If they're in the login/signup process, which is just showing/hiding user controls, I want to be able to intercept the back button so I can show/hide the appropriate control. Note that I'm not familiar with WP7 development, but I believe MVVM Light handles WPF4 & WP7 similarly: <PhoneApplicationPage xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:Interactivity="clr-namespace

Asynchronously loading Blendable sample data in MVVM Light in the view model's constructor

情到浓时终转凉″ 提交于 2019-12-02 05:13:49
I have a Windows Phone 8.1 MVVM Light project and I am struggling to keep it Blendable . As I see it I have a few options. I can load different view models depending on whether ViewModelBase.IsInDesignModeStatic is true in the ViewModelLocator constructor, or I can test ViewModelBase.IsInDesignModeStatic in the view model constructor and load data appropriately. If ViewModelBase.IsInDesignModeStatic is true I need to load data from file. Here's my code: public async Task<ThingsSampleDataSource> GetSampleDataAsync() { if (_DeserializedThingsSampleDataSource == null) { var dataUri = new Uri(

Pass whole row as parameter of DataGridTemplateColumn Hyperlink

岁酱吖の 提交于 2019-12-02 04:43:17
问题 Is it possible to pass a whole row as a parameter for the Hyperlink of DataGridTemplateColumn? <my:DataGridTemplateColumn Header="Name"> <my:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock> <Hyperlink Foreground="Black" TextDecorations="None"> <Run Text="{Binding Name}" /> </Hyperlink> </TextBlock> </DataTemplate> </my:DataGridTemplateColumn.CellTemplate> </my:DataGridTemplateColumn> 回答1: Hard to tell what you are trying to achieve but a ComandParameter binding without a value

Send a empty Message or Notification with MVVM toolkit light

社会主义新天地 提交于 2019-12-02 03:37:02
问题 I'm using the MVVM Light Toolkit. I could not find any Ctor of Messenger or Notification class to send a empty message. ViewModel1: private int _selectedWeeklyRotation; public int SelectedWeeklyRotation { get { return _selectedWeeklyRotation; } set { if(_selectedWeeklyRotation == value) return; _selectedWeeklyRotation = value; this.OnPropertyChanged("SelectedWeeklyRotation"); if(value > 1) Messenger.Default.Send(); } } ViewModel2: Ctor: Messenger.Default.Register(this, CreateAnotherTimeTable)

EventToCommand missing on MVVM Light

限于喜欢 提交于 2019-12-02 03:28:56
问题 This helpful class seems to be gone from the latest MVVM Light build, any idea why or how to work around it? I'm using MvvmLightLibs.5.0.1.0, was definitely there on MvvmLightLibs.4.1.27.0. So this question is not related with one EventToCommand Missing For Windows Phone App Environment: VS2013, WP8.0 回答1: Eventually, I found the EventToCommand class on Galasoft.MvvmLight.Platform. I guess the assembly change makes sense being a multi-platform framework. xmlns:Command="clr-namespace:GalaSoft

Send a empty Message or Notification with MVVM toolkit light

别等时光非礼了梦想. 提交于 2019-12-02 02:25:34
I'm using the MVVM Light Toolkit. I could not find any Ctor of Messenger or Notification class to send a empty message. ViewModel1: private int _selectedWeeklyRotation; public int SelectedWeeklyRotation { get { return _selectedWeeklyRotation; } set { if(_selectedWeeklyRotation == value) return; _selectedWeeklyRotation = value; this.OnPropertyChanged("SelectedWeeklyRotation"); if(value > 1) Messenger.Default.Send(); } } ViewModel2: Ctor: Messenger.Default.Register(this, CreateAnotherTimeTable); private void CreateAnotherTimeTable() { } I just need to send a Notification to another ViewModel, no