am trying to figure out a way for my ViewModel to handle saving or restore the page's state when the page is navigated From or To.
The first thing I tried was to add an EventToCommand behavior to the page, but the events (OnNavigatedFrom and OnNavigatedTo) are declared protected and the EventToCommand does not see the events to bind to....
I have an ItemsContol bound to a Country model - which look like this.
Country
--int Id
--string Name
--List Counties
In the DataTemplate of the ItemsControl there's a Listbox - which is bound to the Counties property.
So what I want is only one item in any of the listboxes be selected at any one time.
For example:
I have an it...
Hi,
I have one usercontrol where am showing the main categories as buttons from the database. By clicking on Main Category button, a new user control is getting opened with list of items in that respective category clicked. I am binding the Item Names of that category in a xaml using TexbBlock and also am showing the checkboxes with eac...
I am creating a Silverlight 4 application with Entity Framework, RIA Services and MVVM-Light toolkit. The application deals with a complex object graph, that contains the following structure:
Job 1->* Resources
Job 1->* Workplans
Workplan 1->* WorkplanItems
Resource 1->* Assignment
WorkplanItems 1->* Assignment
I would like to...
Hi
I am using MVVM light to bind events on UIElements in my View to ICommands in my view model, and this is working very well.
However - I have a situation where I have to create some controls on the fly, and I'm doing this in the code behind on the view as this seems the best place to do it, and it is after all UI code. As I am genera...
Hi guys,
I am using MVVM light toolkit in my wpf application. I would like to know what is the best approach for opening a new window from an existing window. I have got this MainViewModel, which is respnsible for MainWindow of my application. Now in the MainView, on a button click, I would like to open a second window on top of it. I h...
Hello,
To grab some content from a WCF Data Service into my View Model is straight forward:
public const string RequestsPropertyName = "Requests";
private DataServiceCollection<Request> _requests = null;
public DataServiceCollection<Request> Requests
{
get { return _requests; }
set
{
if (_requests == value) { return; }
...
I have an application that has a top level navigation menu which consists of series of buttons within a stackpanel. When a user clicks on a button the view model processes the command and updates the value of CurrentView (type UserControl). The CurrentView is bound to the element ContentControl as below.
<ContentControl Content="{Bindin...
I see in the MVVM-Light package that I can send messages with tokens- what I need to do is send an object, with a message attached to that object- like Add, Edit, Delete whatever.
What is the best way to send and to recieve this message? I think for send its just:
Messenger.Default.Send(myObject, ActionEnum.DELETE);
But in the receiv...
I am trying to use the EventToCommand trigger from the MVVM Light Toolkit to execute a command on the closing event of the window, but I always get Object reference not set to an instance of an object when the window opens. This is a vs2008 WPF 3.5 project and I am referencing GalaSoft.MvvmLight, GalaSoft.MvvmLight.Extras, and System.Win...
I have been building an application, which uses the LoadOperation's Entities to return an IEnumerable which becomes the source of a CollectionViewSource in my View Model. I am now discovering the potential pitfall to this approach, when adding Entities in my Silverlight client, I cannot see these entities, unless I either submit the New...
Hello all.
I'm having some trouble with the EventToCommand not behaving as I would expect with CaptureMouse.
I have a ResizeGrip that I've defined several EventToCommand's on:
<ResizeGrip Name="ResizeGrip" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Mo...
I'm a bit of a .net newbie and I've been working on my first big silverlight project. So pardon the lack of lingo and the length of the question. But my problem is as follows.
The project is being built according to the MVVM pattern ( in this case I'm using LightMVVM ). Most of the views contain ListBoxes. These listboxes need to ha...
I'm trying the MVVM Light Toolkit. Though I still think having multiple ViewModels for such small apps is overkill, I like the concepts. What I still can't quite understand is how (or I should say "what is the recommended way") to navigate from one page to another when the selection changes in a ListBox.
The big problem with this toolki...
I am trying to figure this out, given the following code, does the Refresh() need to occur on the UI thread? It seems to work, and I am wondering if the CollectionViewSource is actually a thread-aware / safe object? It definately has properties and methods to support calling on the correct thread, just not sure if that is left up to th...
I would like to start a collection of MVVM-light (w/ RIA Services) Best Practices. There are a number of items I have found to be helpful best practices or best approaches, but would like to hear from others using the MVVM-light toolkit and see what they have found as well.
Please post your best practices as answers to this question....
Hi all,
I'd like to understand the proper way to build the MVVM toolkit from the source files on codeplex for a WP7 sample app. I've got the source associated with codeplex changset 47157 by lbugnion Apr 18 at 10:42 AM 1300 associated with Release: MVVM Light Toolkit V3 SP1 (2).
I've got VS2010 and Windows Phone Developer tools insta...
There are several examples on how to define a RelayCommand in the ViewModel:
Option 1 (lazy):
/// <summary>
/// Gets the LogOnCommand.
/// </summary>
/// <value>The LogOnCommand.</value>
public RelayCommand<LogOnUser> LogOnCommand
{
get
{
if (this.logOnCommand == null)
{
this.logOnCommand = new Relay...
When defining a RelayCommand in the ViewModel, this is normally done using once [lazy or in constructor] (see here for examples).
But is this safe ?
What if multiple RelayCommands from the same instance are queued (multiple clicks from same button on the GUI), and for the first command the 'CanExecute' is changed to false, will the othe...
Trying to solve a very simple problem using mvvm-light, but after days of sifting through StackOverflow and lots of Google searches, I have not come up with a simple solution.
I have a ListBox with a dataTemplate. The dataTemplate contains one userControl to display the content
<ListBox ItemSource={Binding Posts} >
<ListBox.ItemTem...