mvvm

some mvvm issue - knowing which view is currently editing an entity

I'm trying to plan an mvvm based infrastructure, i decided that the view will be bounded directly to the entities through the vm. (the vm will hold the entity reference, and binding will be o entity.propertyName...) now i got a problem, when user start editing fields in one view, i wanna lock(make readonly) all other view that bound to ...

WPF - Input Gesture activates only active window.

Hello, I'm using the MS Ribbon Library in the latest .NET 4.0. I've started working with the RibbonCommand and thought I'd make it fancy with some InputGesture. I found that when I've added the InputGesture to the RibbonCommand, the commands are executed regardless if the window with the RibbonControl is active or not. Is this part of ...

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 ...

ObjectDataProvider in MVVM not neccessary?

Hello, I have created a simple MVVM, with only three classes CashFlowView, CashFlowViewModel, CashFlowModel. I use an infragistic's 9.1 XamDataPresenter (or xamDataGrid). <igDP:XamDataPresenter Name="xamDataPresenter1" DataSource="{Binding Source={StaticResource CashFlowData}}"> <ObjectDataProvider x:Key="CashFlowData" Obje...

Which WPF control suite is best suited to MVVM?

It seems that the only way to really evaluate a UI control suite is to download the trial and invest many hours in understanding its limitations and design flaws. However, with so many to choose from, I am trying to shorten this process by ruling out those that fail to meet a key criterion - MVVM compatibility. What are your experiences...

How can I execute a command binding on MouseEnter of a StackPanel in WPF?

I'm using MVVM. <ItemsControl ItemsSource="{Binding AllIcons}" Tag="{Binding}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel> <Label HorizontalAlignment="Right">x</Label> <Image Source="{Binding Source}" Height="100" Width="100" /> <Label HorizontalAlignm...

Problem with DataBinding in mvvm

I have big problem with databinding. I cant bind data to children control. I'm really newbie in MVVM and I spend a lot of hours at this example and I have no idea what is wrong with this Code. Little explanation: I have MainWindow. It has UserControl to display list of todo. I want to set my MyWindow class ParentViewModel as DataConte...

WPF/Silverlight Programmers: Is MVVM Overkill?

Hello, I just have mixed feelings about MVVM. It seems I need to code so much to get the most remedial things to work. I miss events (commanding is such a pain), and I miss having a reference to the view! I was just wondering about your feelings of MVVM vs the plain old code behind way. What do you like better and/or what do you normal...

How can I convert business layer exceptions into validation errors in SL4?

I'm fairly new to Silverlight and RIA. However, we're developing an app with a SL frontend using WCF/RIA to connect to our service layer. We're using the mvvm pattern so that may play into this as well. I have a particular dataform where I use commanding to hook the EditEnding event of the dataform. In EditEnding, I call my Service to...

How to pass Model object (to which data binding is done in view) between two views in MVVM

Hello, I am prototyping a windows phone 7 application in silverlight. I am trying to use MVVM pattern in my application. I have the following situation: I navigate from one view1 (page) to another view2 (page) using NavigationService.Navigate("uri of next page") method [Please note NavigationService is a sealed class, so cannot be overr...

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...

Variable grid row count with MVVM

Hello, I need to control the number of rows in a grid. Without using the MVVM pattern, I achieved this with code-behind, this way : <UserControl> <Grid x:Name="PART_Host" /> </UserControl> private void UpdateHost(int rowCount) { PART_Host.RowDefinitions.Clear(); PART_Host.Children.Clear(); for (int i = 1; i <= rowCoun...

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...

Binding depending of type in WPF

I have a ParentViewModel which has ObservableCollection named Notices. public class Notice { public string Content { get; set; } public NoticeType Type { get; set; } } I have static controls at user control where I want to bind this observablecollection to this static controls. And I don't know how bindin...

Binding to a value that gets updated in the ViewModel in MVVM?

I'm new to MVVM. I have a label in my view that looks like this: <Label Content="{Binding Path=ClockTime}" /> And my ViewModel looks like: Public Class MainWindowViewModel Inherits ViewModelBase Dim strClockTime As String Dim dstDispatcherTimer As New Windows.Threading.DispatcherTimer Public Sub New() AddHandler dstD...

List with owning and not owning stuff for object

I have: public class Extra { public string Name {get;set;} } and I have public class CarViewModel { public ObservableCollection<Extra> OwningExtras { get; set; } public static IEnumerable<Extra> AllExtras { get { return Extra.GetAllExtras(); } } public CarViewModel(...

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...

Interface Controller (ViewModel) for multiple UI's

I am currently designing a new .NET application and would like to keep it UI independant. Whilst I initally would like to use WPF, I would like to have the option of swapping the UI to ASP or WinForms if necessary. In a layered design: View - Interface Controller (ViewModel) - Model - Persistance is it possible to design the Interfa...

What's with empty code-behinds?

I understand the benefit to unit testing of preferring the view-model over the code-behind. However, I cannot understand the obsession with achieving completely empty code-behinds. At compile time, the code behind and the XAML are combined, so they are actually the same thing. I, to, love using XAML due to its declarative nature which...