mvvm

DataGrid Sorting retention on ItemsSource Changed

Hi All, I am using an MVVM approach. I have a ViewModel and View called AllSomethingViewModel and AllSomethingView. The View Model contains a list of SomethingViewModels and a SelectedViewModel. The View contains a usercontol bound to the AllSomethingViewModel's SelectedVM property and a listbox control that lets me select a VM. Basica...

DomainDataSource and ViewModel, can it be used together?

Hi, I want to make use of a DomainDataSource control from the RIA controls on my View, but for query parameters I have to pass the DomainDataSource to my ViewModel, currently I contruct the ViewModel in the code behind of the View and pass the DomainDataSource to the ViewModel. This works very well as I have full control over the Domai...

wpf mvvm - how to send message only to parent?

Hey. I'm building my first app using MVVM and I stuck. Using the messenger to communicate other ViewModels about some changes was working ok until I tried to build an observablecollection of objects. I have a class (myClass) that contains a list (innerList). Elements of innerLists should send message to it's parent (to communicate that...

Alternatives to PRISM

I am starting a large Enterprise level Silverlight Application, and i am not looking at PRISM since i would not be using many of its capabilities. But i intend to design the application modular and use MVVM. What are my best alternatives to PRISM? Thanks. ...

How do entity self-tracking with changes in VM and UI?

my context: Entity Framework 4.0 + WCF Ria Data Service + Silverlight 4. Suppose I have entity People from EF, then I created PeopleVM like: public class PeopleViewModel : ViewModelBase { public PeopleViewModel(){ //.... this._hasChanges = MyDomainContext.HasChanges; } private People _Peopl...

Proper way to display a view using MVVM

I am brand new to both wpf and MVVM. I have a Mainwindow that has two views left side has a usercontrol with a listbox and the list box has a edit button inside of it. On the right I have another view that contains all my controls for viewing and editing the record. I can select an item in the list box and edit my record since using b...

Changing a property in ViewModel making Model unserializable???

Alright I'm a bit baffled by this one. Changing an unrelated int property on my ViewModel seems to be making my Model unserializable. I have an object which tracks the best time to contact someone. It can be set to Anyday, Weekdays, Evenings, SpecificDays and to Anytime, Mornings, Afternoons, Evenings, and SpecificTimes. When the object...

MVVM Window / Control Operations

I'm building a WPF MVVM application and I'd like to keep what I can conforming to MVVM (I know some stuff is over-engineering, putting a best effort here though). I've run into a small dillema, I need to Hide / Close a window based on some logic in one the the methods in the view model. I can't for the life of me come up with a reliabl...

WPF: Binding a ContextMenu to an MVVM Command

Let's say I have a Window with a property returning a Command (in fact, it's a UserControl with a Command in a ViewModel class, but let's keep things as simple as possible to reproduce the problem). The following works: <Window x:Class="Window1" ... x:Name="myWindow"> <Menu> <MenuItem Command="{Binding MyCommand, ElementNam...

Silverlight MVVM and ViewModel Lifecycle

I'm working on a Silverlight 4/RIA services app, and I'm wondering when ViewModels are unloaded on the client. Specifically, I need to know if additional clean-up is necessary when a user logs out (I don't want another user to log in before the app is unloaded in the browser and potentially have access to data they shouldn't). My und...

Grouping items in a combobox

I have a listview that contains two types of objects, single and multiple. The single is a ordinary textblock while the multiple is a combobox with items. I'm trying to group the items in the combobox without success. Is it possible? Or should i go for a different approach? What i'm trying to achieve: [Combobox v] [Header ] [...

Preventing the User to select a tab WPF Tab Item

I had to prevent the user from selecting a tabitem in a WPF TabControl, 1)unless and untill the user checks a check box in one condition the user should be shown a message box and if he checks the check box he can navigate to any other tab 2)Checking a particular condition the user shouldnt be able to get into a particular tab on selec...

MVVM Light and SL3 Commanding

I am familar with MVVM. Actually been doing most of my learning in SL4. However, with a recent need, I have to use SL3. I am attempting to use MVVM Light v3 with SL3 and utilize commanding. The problem is that in SL3 there is no Command attribute for buttons. I managed to find an old article (http://blog.galasoft.ch/archive/2009/09/26/us...

Retrieve values entered through a usercontrol

I have a usercontrol consisting of two DateTimePicker This component must be reusable and should expose properties which define, for example, the Visibility of elements, the WIDTH of the container, etc.. And of course, I'm able to retrieve the values entered. So I created adequate DependencyProperty public DateTime StartDateVal...

Adding controls dynamically to the Grid in the constructor from ViewModel

Hi, I want to add Controls dynamically from ViewModel. I have to add Button and Textbox dynamically to the Grid. In the ViewModel constructor call I need to add the controls. I am not getting how to get the Grid control reference in my ViewModel. Can anybody help me on this? Thanks in advance ...

Binding in Label.ContentTemplate

In the Xaml below, the first control (the TextBlock by itself) has no problem binding and rendering the value of RecordCount. But in the second control (the Label with the ContentTemplate), the value of RecordCount is not rendered. However, the literal "Cars" is rendered fine. So I know the ContentTemplate is working, but the binding ...

Supporting multiple "display modes" menu in a Silverlight Prism application

Assume a standard Desktop Explorer style app: menu at top navigation tree on left item view on right and everything is neatly separated into Menu, Navigation and Item modules. The menu has a generic "View" -> "Display mode" menu selection, that changes the current item view between: "Icon view" "List view" "Detail view" To catch...

Prism and MVVM for new WPF project

I will be starting a new project soon and am looking for some architectural advice from those of you who have experience with WPF, Prism, and MVVM. The project will definitely be WPF and I will be implementing MVVM (I will likely use Josh Smith's MVVM Foundation as a starting point) in order to be able to benefit from the separation of ...

Is it possible to tell the WPF binding to respond asynchronously to a PropertyChanged event (low priority)?

I've got a long list of items which I'd like to filter. I've added an IsFiltered property to the view model in my list. Using an ItemContainerStyle I'm able to bind the ListViewItem's visibility to the IsFiltered property. <ListView ItemsSource="{Binding Path=MyItems}"> <ListView.ItemContainerStyle> <Style TargetType="{x:Ty...

SL4 MVVM pattern: How do I write metadata driven (Entities) validations and validate them on the UI using INotifyDataErrorInfo?

Hi All, I have a entity that has metadata validations like [Required], [RegularExpression]. I have seen that the generated code g.cs file implements the INotifyDataErrorInfo interface for that entity. The property on which I have defined the regular expression is bound to a text box in the UI(XAML). How do I have the validation errors d...