mvvm

Programatic re-evalutation of MVVM command's "can execute" state

Hello! I'm writing a WPF application using the MVVM pattern, based on the following article: WPF Apps With The Model-View-ViewModel Design Pattern I have two buttons on my View with the buttons' "Command" property bound (with data binding) to a given instance of the RelayCommand class (see "Figure 3 The RelayCommand Class" from the art...

Is there anything similar to WPF and MVVM in Java world?

Is there anything similar to WPF and MVVM in Java world? ...

WPF ComboBox Binding to non string object

I'm using MVVM (MVVM Light Toolkit) and have a property on the view model which exposes a list of objects. The objects contain two properties, both strings, which correlate to an abbreviation and a description. I want the ComboBox to expose the pairing as "abbreviation - description". If I use a data template, it does this easily. I ...

Silverlight dataform MVVM command binding on update.

I'm new to MVVM and Silverlight and I'm just trying to figure out a simple scenario. I'm using the MVVM Light toolkit and Silverlight 3.0 without Expression Blend. I have a DataGrid and a DataForm bound to an observable collection in a ViewModel. I would like to bind to my RelayCommand Save() property after I make changes to the data i...

Strange behaviour of CheckBox and TwoWay bound property

Hello, everyone. I fell in the following situation: I have a main UserControl with a DataGrid (which contains List). I need to show different panels depending on properties of the selected row(object). So i've created 2 controls and included them into this main control. Main control has 2 public properties - public List<ComplexObject> ...

How many layers is too many?

As I have been learning about software development the last 2 years the more I learn, it seems the more gray areas I am running into. One gray area I have issues with right now is trying to decide how many layers an application should have. For example, in a WPF MVVM application what fashion of layering is ok? Is the following too sep...

Display a running number in the WPF DataGrid RowHeader

Hello, I am using WPF with MVVM. How can I bind: a list of numbers or a list of clr objects with property number or a list of strings in my ViewModel to the RowHeader of the WPF DataGrid ? ...

Silverlight communication/commands/events? between view and viewmodel?

I am just getting into the Silverlight world, and wish I didn't learn WPF first so I wouldn't be so frustrated with the little things that are missing. In WPF I was using commands (RoutedUICommand) for my view/UI to handle "events" (by event I mean something the user did) and passing them to the viewmodel. Now in silverlight I find tha...

Silverlight ~ MVVM ~ Dynamic setting of Style property based on model value

I have a class called Question that represents a question and it's answer. I have an application that renders an ObservableCollection of Question objects. Each Question is rendered as a StackPanel that contains a TextBlock for the question verbiage, and a TextBox for the user to enter in an answer. The questions are rendered using an Ite...

WPF binding to collection and adding new item to collection using MVVM

This is probably a simple question... I have a window with a listbox of employees and a # of textboxes for displaying or entering data. The listbox of employees is bound to an observable collection in my ViewModel, which is read from a database. Right now I have a SelectedEmployee property that the textboxes are bound to, so if a user...

MVVM: Difference using EventToCommand vs. Attached Behaviour for Events

Hello, doing a doubleclick on a wpf selector like datagrid I can use a DoubleClickSelectedBehaviour like Sacha Barber has done in his cinch framework or I can use the EventToCommand class from the mvvm light toolkit framework. Both seem to pass the EventArgs and violate mvvm by putting View related stuff into the ViewModel what is...

MVC2 DataAnnotations on ViewModel - Don't understand using it with MVVM pattern

I have an MVC2 Application that uses MVVM pattern. I am trying use Data Annotations to validate form input. In my ThingsController I have two methods: [HttpGet] public ActionResult Index() { return View(); } public ActionResult Details(ThingsViewModel tvm) { if (!ModelState.IsValid) return View(t...

MVVM, Animations, Binding - I need a quick question answered.

http://stackoverflow.com/questions/2455963/wpf-mvvm-dynamic-animation-using-storyboards There is a question i have found that relates directly to the issue I am having. The answer provided in that thread is a bit short, however. I did a little looking on google for 'attached properties' and i still remain a bit confused. Could someon...

Using MVVM, how to pass SelectedItems of a XamDataGrid as parameter to the Command raised by the ContextMenu??

Hi, I'm trying to pass the item on XamDataGrid on which I do a mouse right click to open a ContextMenu, which raises a Command in my ViewModel. Somehow the method that the Command calls is not reachable in debug mode. This is the snipped from the view <ig:XamDataGrid DataSource="{Binding DrdResults}" Height="700" Width="600"> ...

TabItems from View collection

I am using MVVM. I have a tab control. I will have a collection of items. I want to display each of this item in the collection as a tab item. The view in each tab item is different and may have its own viewmodel. How do I achieve this? E.g. I have 3 items in the collection. The Tab item template contains an ItemControl. I would like to ...

Disable Adding Item to Collection

Hi All, I'm sure there's an "easy" answer to this, but for the moment it escapes me. In an MVVM application, I have a property that is a ObservableCollection, used for displaying some set of elements on the view. private readonly ObservableCollection<MyType> mMyCollection = new ObservableCollection<MyType>(); public ObservableCol...

Wpf Mvvm ComboBox

Hi All, I am new in the Wpf world, so I created a couple of views and all of them have at least one ComboBox, as I am using the MvvM pattern, I get my self re-typing all the time the same line of codes to fill the Combo and to get the SelectedItem (creating properties, privates for fill and other to get). Is there some kind of framewor...

MVVM Binding To Property == Null

I want to show some elements when a property is not null. What is the best way of achieving this? The following is my ViewModel: class ViewModel : ViewModelBase { public Trade Trade { get { return _trade; } set { SetField(ref _trade, value, () => Trade); } } private Trade _trade; } ViewModelBase inherits I...

C# MVVM Calculating Total

I need to calculate a trade value based on the selected price and quantity. How can The following is my ViewModel: class ViewModel : ViewModelBase { public Trade Trade { get { return _trade; } set { SetField(ref _trade, value, () => Trade); } } private Trade _trade; public decimal TradeValue { ...

Why should I use MVVM when it breaks built in riaservices functionality

I'm struggling to grasp why MVVM is really a good pattern to implement in riaserivces, To me there's nothing but trouble to it, it just add's another tier that I have to code. I Get that I could change the UI, but really I don't need to. Instead i won't be able to user out of the box functionality with riaservices, datagrid, dataform all...