mvvm

Silverlight - Add Ellipses to a canvas dynamically with MVVM

I want to add a dynamic number of ellipses to a canvas and set the ellipse position (canvas.top, canvas.left). I tried binding to an ItemsControl but it each item (ellipse) has a container, so I cant set the ellipses position directly. I don't want an items container, I just want a canvas that contains ellipses. Can this be done? ...

How to pass multiple parameters and EventArgs properties when using EventToCommand in MVVM-Light toolkit

Hi guys, I am using MVVM Light toolkit for my WPF application and I would like to know if its possible, when using EventToCommand, to pass multiple parameters to RelayCommand and Is it possible to pass properties of EventArgs instead of passing the whole EventArgs ? Regards, Nabeel ...

How should I handle this common UI scenario in MVVM?

The scenario: Parent Window loads, fills data (grid, labels, etc.) User clicks a button, firing a bound command in the Parent Window's ViewModel, launching an Edit Dialog User makes changes in the Edit Dialog and clicks "Accept", saving some information to a database Parent Window's ViewModel recognizes that something happened (noticin...

MVVM - how show view?

My MVVM application started with App.xaml.cs Here I create a main window. It has frame. Here I put LoginView. It has button "Login". I have command, which checks and do login. This code I have in LoginViewModel. If all ok - I should show the next View. How I can do it? App.xaml.cs private void OnStartup(object sender, Start...

Would this architecture strategy work for a business application written in F#?

I've been considering how you would write a business application in only F# with WPF. Here's my thinking of a general outline of how to go about it, but I'm looking for whether or not it will work: Start with ADO.NET Entities to automatically generate a data access layer. Since F# doesn't support partial classes, use F# Extension Meth...

Need help understanding MVVM Tutorial, RelayCommand & Use of lambdas

i am reading this tutorial i don't understand what the below code is trying to do. 1st, the syntax reminds me properties, but with add/remove instead. but what is CommandManager.RequerySuggested? It delegates the event subscription to the CommandManager.RequerySuggested event. This ensures that the WPF commanding infrastruct...

WPF Databinding - bind Visibility to different source than DataContext

(I'll explain the problem once I show my ViewModels and Views) I have two ViewModels: public class CommandViewModel { public string DisplayName { get; set; } public ICommand Command { get; set; } } and public class SomeViewModel : INotifyPropertyChanged { private bool someFlag; private CommandViewModel someCommand; ...

How to handle events in MVVM

I am new in MVVM. I just learn this pattern and want to use it in my project. I am already understand working principle of this pattern and learned how to use Commands. But I have question how to handle events of another controls for example ListBox SelectionChanged event. ListBox haven't Command attribute ...

ADO.NET Entity Framework: Problem with updates on related objects

Hi experts, I’m playing around with a little VB.NET app with WPf/MVVM and ADO.NET EF on a SQL Express-DB and I’m running into problems while trying to update related objects: My DB has three tables “tb_Actors”, “tb_Movies” and a junction table “tb_movies_actors”. The EF designer creates two entities "Actors" und "Movies" and sets thei...

design pattern problem

Hello I have a application design problem and I home you can help me solve it.... This is my first application in silverlight and the first application using mvvm design pattern and I am not sure I am applying mvvm how I am supposed to.. The application is a dynamic application and at runtime I can add/remove usercontrols... So I have ...

PagedCollectionView memory leak Silverlight 4

Hi! I have observable collection with some items. /// <summary> /// The <see cref="Items" /> property's name. /// </summary> public const string ItemsPropertyName = "Items"; private ObservableCollection<SomeItem> _items = new ObservableCollection<BrandItem>(); /// <summary> /// Gets the Items property. ///...

Integration Testing a ViewModel that calls WCF Services asynchronously in a WPF MVVM Application

The Silverlight Toolkit contains Unit Testing Functionality that allows to test classes such as the ViewModels in a MVVM application that invoke remote Services asynchronously. I would like to be able to perform my ViewModel Integration Tests against the actual services instead of mocked instances. Is there any support for asynchrono...

Using WPF DataGridComboBoxColumn with MVVM - Binding to Property in ViewModel

I'm using the excellent MVVM Light Toolkit. My ViewModel exposes: public const string CourtCodesTypeCourtPropertyName = "CourtCodesTypeCourt"; private List<CourtType> _courtCodesTypes = new List<CourtType>(); public List<CourtType> CourtCodesTypeCourt { get { return _courtCodesTypes; } set { if (_co...

How to Bind data to DataGridComboBoxColumn in DataGrid using MVVM

This is driving me crazy. I have a DataGrid which has a DataGridComboBoxColumn which I want the user to be able to use to select from. This is the basic outline of my grid. <DataGrid ItemsSource="{Binding GoalList}" DockPanel.Dock="Bottom" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridComboBoxColumn ItemsSource="{Binding Life...

MVVM - Deciding which ViewModel is responsible for what

I have a simple app that consists of: Model Items Filter criteria applied to that list of items Views WelcomePage MainItemsPage FilterEditPage I am using MVVM Light and Windows Phone 7 I currently have 3 ViewModels, one for each View. In the past I have had a single ViewModel which made the comunication which I am about to ask...

How to solve a HasMany relation in MVVM to show up in one row in a datagrid

Hi, i have a class Auswahl with some plain properties and a property RefFilters of type List<RefAuswahlFilter> What i want to achieve is: Display all Auswahl Properties in a datagrid with all RefFilter items in ONE row. the Problem is, the count of RefFilter is different from auswahl to auswahl object. in the past i use a datatable as...

MVVM WPF Best way to ensure ViewModel is up to date with Business Layer / Back End

I am trying to use MVVM in my WPF application which displays data from a class in the business logic layer called 'Employee' with a property 'Salary'. I have a simple XAML window with a text box with binding to the Salary property in a ViewModel class 'EmployeeViewModel'. The ViewModel implements INotifyPropertyChanged so that when the ...

WPF: How do I start styling a DataGrid that was built using MVVM?

I have a list of names that I'd like to have bound to a datagrid for editing/sorting/etc. But, I don't like how the DataGrid is displayed at all. Columns are placed in Alphabetical order when I really want a custom order (and I wish I could hide the ID column, or make that column not editable). I'm not sure how to start doing any of this...

How to use AlternationIndex in ItemsControls?

I have seen some articles that show how to use AlternationIndex with ListBoxes or ListViews, but I had spent a few hours trying to get alternating background colors on the base ItemsControl class and nothing seems to work. All ListBox samples I saw use ListBoxItem as the target type for the style that sets the background based on Alterna...

How to implement undo/redo in a MVVM application?

I'm working on a Silverlight LoB app which the designers want to have a tabbed-interface, similar to the interface of Visual Studio (we'll probably use the Telerik Rad controls for docking tabs). Having done a prototype, the interface is working well so far, but I'm having problems thinking of how to implement undo/redo functionality in ...