mvvm-light

What is the best way to collapse an optional Grid Column at runtime?

Currently I have a Grid with 6 optional fields, one on each row, in a data template bound to my view model. 6 Rows - 2 Columns Column 0 has the label Column 1 has the content associated with the label. In this case I want to collapse the column when the Column 0 label is null. My plan is to simply create a converter, if content is ...

Dynamically creating checkboxes from database using MVVM

Hi, How to create dynamic checkboxes at run time from the databases values using MVVM pattern. I have set all the table columns as get;set; properties in Model. But not getting how to create the checkboxes using MVVM and where to put what means where to put database connections and functions for that and how to bind the dynamically crea...

Question about ViewModelLocator in Mvvm Light

Hi, I have just started to use and learn mvvm pattern with the help of MVVM Light toolkit. I want to use MVVM Light in my project but I dont know how to use ViewModelLocator. I am not getting what it is used for. Kindly suggest with samples or examples. Thanks ...

List<> Binding and button clcick using mvvm light

Hi, I am trying to use MVVM light to achieve something like this. I have the following scenario: In my Model--I have set the properties like ActivityName,Image and there is a class constructor whose is accepting 2 parameters like name and image. Im my DataAccess--I have set the database connection and implement the required method who...

mvvm-light toolkit not firing Window Loaded event

I have a Window and using MVVM light toolkit to bind to the Loaded event: <Window ... xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WPF4" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" ... > <i:Interaction.Trigg...

Mvvm Silverlight, using binding to Programmatically style rows in a SilverLight DataGrid

Is it possible to bind a rows in a Silverlight DataGrid to some sort of style property in a ViewModel so that styles can be applied programatically / dynamically? I've been using the Mvvm-Light toolkit quite successfully to create an mvvm silverlight app, this is the first major stumbling block I have hit. Thanks in advance for any he...

Creating a dynamic checkboxes against the list of items using mvvm light wpf?

Hi, I have the following scenario: I have one window say MainWindow where I am displaying the list of activities as per the specific user from the database. There is a one button present on the window. By clicking on that button a new window is getting opened having all the list of activities from the master table. Now I want add a che...

Inject toolbar into another view

I'm using mvvm for my new project. I have a message dispatcher to send messages between viewmodels but in one case I have to receive messages in a view. This view contains a toolbar panel that must contain the toolbar related to detail view (example editing a customer needs a toolbar with Save, Undo, Redo, Cancel). The problem is that I...

How to use MVVM Light Toolkit with existing non-MVVM Light Toolkit project

I need to use the Surface project template for the application that I am working on but I also want to use the MVVM Light Toolkit too. I see that I can "Add | New Item..." and choose an MVVM teamplate for a view, view model, or locator but there seems to be a few more things I need to do to wire this up beyond adding one of those and ma...

RaisePropertyChanged<T>(string propertyName, T oldValue, T newValue, bool broadcast)

Hi, I was trying to get the RaisePropertyChanged<T>(string propertyName, T oldValue, T newValue, bool broadcast) working but could not get it to work. I am not implementing it in any real world scenario but just for learning it. If I raise broadcast the usual way only then it works Messenger.Default.Send<PropertyUpdateeMessage>(new Pr...

getting selected checkbox items from listbox mvvm

Hi I have listbox in which I am dynamically showing the pre selected checkboxes from the database. Now I want to loop through it to get the selected items/values. I am using mvvm light wpf. kindly Suggest? Thanks ...

Confusion about INotifyPropertyChanged and updating Bindings

From what I (thought to) understand is that implementing INotifyPropertyChanged within the ModelView, allows to raise the PropertyChanged event in case a property has been modified. That way the View should get to be notified that the underlying property has changed and hence the UI should fetch the new changes. Did I get the theory ri...

mvvm-light and silverlight 4 compatibility

Hi, I've downloaded the mvvm light toolkit source 4157, and try to use the EventToCommand.SL sample. It works well in Visual Studio 2010, if I use the silverlight 3 framework. But if I select the silverlight 4 version (EventToCommand.SL project properties), nothing appears : the ViewModel method associated with the Command property is ...

How to set the selected item on a listbox after binding using MVVM Light?

I'm using MVVM Light on an Windows Phone app. I would like to set the selected item on a listbox after it is databound. I thought the best way to do this is to setup an eventToCommand on the listbox for the Loaded event and pass the element to set the selected index, but I'm not sure how I can pass the listbox element to the RelayCom...

Reload parent window from a pop-up ("child") window

Hi, How it is possible? The idea is to enter info into a form inside a pop-up/child window, and then, as you save/close it, it automatically updates the "Parent" window, from which the pop-up was originally open. Kindly Suggest, Thanks ...

MVVM Light Messenger - How do you unit test targeted messages?

If I target a message from ViewModelA to ViewModelB, is there a way to catch this notification from my unit test that is testing ViewModelA where the Message is raised? Messenger.Default.Send<string, ViewModelB>("Something Happened"); ...

How to have a blendable project using MVVM-Light and WCF RIA Services

Hi. I'd like to build my business application using the MVVM pattern. I choose MVVM-Light because it fits to my needs. In every example I've seen about MVVM-Light, no-one use the WCF RIA. The classic MIX10 example uses a Service in the same project while WCF RIA create a service in the Web project. The question is: it looks very hard to ...

Adding runtime label as content in checkbox wpf

Hi, I am dynamically creating the checkboxes at runtime and also applying the style at runtime. Designer has developed a checkbox like control that am applying at runtime. and he put a Label on that checkbox control to show the Text on the checkbox control as its content from the Database. But when i applying content of checkbox or labe...

How do you reference the matching object from a DataTemplate in XAML?

I want to use CommandParameter attribute in a context menu associated to a DataTemplate. The commandParameter should contain a reference to the object that triggered the data template as shown in the code sample below. I tried to use "{Binding Path=this}" but it does not work because "this" is not a property. The command fires but I can'...

TreeViewItem.Expanded

Im using the latest version of mvvm light toolkit, however i'm not clear how I can use EventToCommand for the event TreeViewItem.Expanded. THis dosent work... what am I doing wrong? <TreeView Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Path= MonitoredDatabases}"> <TreeView.ItemTemplate> <HierarchicalDataTempl...