mvvm

WPF: Cancel a user selection in a databound ListBox?

How do I cancel a user selection in a databound WPF ListBox? The source property is set correctly, but the ListBox selection is out of sync. I have an MVVM app that needs to cancel a user selection in a WPF ListBox if certain validation conditions fail. Validation is triggered by a selection in the ListBox, rather than by a Submit butto...

Databinding an enum to a ComboBox in WPF + MVVM

I've read this very related question here on SO, and it was extremely helpful because of the link in the answer. I'm just having a problem now going the extra step and making it all work with the MVVM pattern. Let's say I have my ViewModel, and it (or even the Model) could have an enum defined: public enum MyTypes { Type1, Type2, Type...

RadTabControl and MVVM

First, so you know, Silverlight 4 and VS 2010 both RC and RIA services. I'm also new to Silverlight... I have a page that has a Telerik RadTabControl on it. It will always have six tabs, i.e. the number of tabs is not data driven. The tabs are used for various admin functions. One tab for managing users with a grid and edit view, an...

what's the difference between MVVM and Prism v2

Hello, what's the difference between MVVM and prism v2 design pattern to develop SL and WPF applications? ...

Defining reliable SIlverlight 4 architecture

Hello everybody, It's my first question on SO. I know that there were many topics on Silverlight and architecture but didn't find answers that satisfies me. I'm ASP.NET MVC developer and are used to work on architectures built with the best practices (loose coupling with DI, etc.) Now I'm faced to the new Silverlight 4 project and woul...

MVVM- How can I bind to a textbox's SelectionStart and SelectionLength properties?

What would be the best way to do this? ...

When should I use a UserControl instead of a Page?

I notice that many of the WPF MVVM frameworks seem to avoid using the NavigationWindow and Page controls in favor of composing pages using nested UserControls. The NavigationWindow and Page provide easy ways to enable back and forward navigation in the journal as well as providing an easy way to pass data among pages. Most MVVM framewo...

MVVM pattern: ViewModel updates after Model server roundtrip

I have stateless services and anemic domain objects on server side. Model between server and client is POCO DTO. The client should become MVVM. The model could be graph of about 100 instances of 20 different classes. The client editor contains diverse tab-pages all of them live-connected to model/viewmodel. My problem is how to propaga...

Silverlight with MVVM Inheritance: ModelView and View matching the Model

Hello Stackoverflowers! :) Today I have a special question on Silverlight (4 RC) MVVM and inheritance concepts and looking for a best practice solution... I think that i understand the basic idea and concepts behind MVVM. My Model doesn't know anything about the ViewModel as the ViewModel itself doesn't know about the View. The ViewMode...

How can I use a parent content control from a sub binding?

I have the following code currently: <DataTemplate DataType="{x:Type vm:SectionViewModel}"> <ScrollViewer> <ItemsControl ItemsSource="{Binding ViewModels}"> </ItemsControl> </ScrollViewer> </DataTemplate> <DataTemplate DataType="{x:Type vm:StringViewModel}"> <Grid> <Grid.ColumnDefinitions> ...

Databind a datagrid header combobox from ViewModel

I've got a Datagrid with a column defined as this: <Custom:DataGridTextColumn HeaderStyle="{StaticResource ComboBoxHeader}" Width="Auto" Header="Type" Binding="{Binding Path=Type}" IsReadOnly="True" /> The ComboBoxHeader style is defined in a resource dictionary as this: <Style x:Key="ComboBoxHeader" TargetType="{x:Type my:DataGridCo...

Repository Pattern with Entity Framework 3.5 and MVVM

I am developing a Database File System. I am using - .Net framework 3.5 Entity Framework 3.5 WPF with MVVM pattern The project spans across multiple assemblies each using same model. One assembly,let's call it a "server", only adds data to the database using EF i.e. same model.Other assemblies (including the UI) both reads and wri...

Rendering a WPF Network Map/Graph layout - Manual? PathListBox? Something Else?

I'm writing code to present the user with a simplified network map. At any given time, the map is focused on a specific item... say a router or a server. Based on the focused item, other network entities are grouped into sets (i.e. subnets or domains) and then rendered around the focused item. Lines would represent connections and gro...

WPF User Control hell with MVVM and Dependency Properties

This is what I'm trying to do: I'm writing a UserControl that I want to be consumed by other developers. I want end users to be able to use my control using Dependency Properties. <lib:ControlView ControlsText={Binding Path=UsersOwnViewModelText} /> I'm using the MVVM pattern. I'm binding my ViewModels to their View's using <DataTempl...

MVVM Light toolkit - maintained? Here today - gone tomorrow? ...

Hi there, I have been taking a look at mvvm light toolkit, i must admit i haven't got a lot of experience with it but i live what i see.. I did use the mvvm toolkit (microsoft) but currently use vs 2010 and no templates are available as yet. I was looking for some insight into mvvm light toolkit... Is it always maintained ? i..e its...

WPF MVVM: TextBox and default Button binding does update too late

I've got a simple WPF dialog with these two controls: <TextBox Text="{Binding MyText}"/> <Button Command="{Binding MyCommand}" IsDefault="True"/> Now, when I enter some text in the TextBox and click the button using the mouse, everything works like expected: the TextBox will set MyText and MyCommand is called. But when I enter some t...

M-V-VM, isn't the Model leaking into the View?

The point of M-V-VM as we all know is about speraration of concerns. In patterns like MVVM, MVC or MVP, the main purpose is to decouple the View from the Data thereby building more flexible components. I'll demonstrate first a very common scenario found in many WPF apps, and then I'll make my point: Say we have some StockQuote applicati...

DateTime Property not firing PropertyChanged event when changed

I'm working on a WPF MVVM application and I've got a TextBox on my view that is bound to a DateTime property on the ViewModel. Seems simple enough, but when I clear the text in the TextBox, the property never changes. In fact, it never even fires until I begin typing "4/1..." and then it fires. What can I do to fix this? Obviously I ...

WPF MVVM: how to bind GridViewColumn to ViewModel-Collection?

In my View I got a ListView bound to a CollectionView in my ViewModel, for example like this: <ListView ItemsSource="{Binding MyCollection}" IsSynchronizedWithCurrentItem="true"> <ListView.View> <GridView> <GridViewColumn Header="Title" DisplayMemberBinding="{Binding Path=Title}"/> <GridViewColumn Header="Name" Display...

How can I simulate the effects of an observable collection in this situation?

I am making a configuration editor for another application and am using reflection to pull editable fields from the configuration class. The following class is the base class for my various "DataTypeViewModels" and shows how I get and set the appropriate properties. public abstract class DataTypeViewModel<T> : ViewModelBase { Func<T...