mvvm

Binding multifunctional WPF DataGrid

How would you go about binding a WPF datagrid that needs to display data from many different datasources with varying number of columns with different column headers and types? What I'm currently doing is creating a custom List<DataGridColumn>() list of datagrid columns in my ViewModel for each different collection of records to be disp...

Beyond Data Validation Styling: Styling based on other properties

I hope that this question has not been asked elsewhere, but I'm having difficulty finding the right search terms to bring up any already-existing answers to this problem. I'm implementing a program in C# WPF (MVVM) with many interview-style screens where the user inputs scientific data in an orderly manner. We would like to have the T...

multilevel tabcontrol - which collection we use to bindin mvvm

Hi, I have a wpf application which uses mvvm pattern. I need to have a collection in my view-model...which i can bind to multi level tab control. What type of collection I can use in this case ??? Is there any hierarchical collection in C# 3.5 ??? ...

Bind IsClosed property of context menu

I have project which implements MVVM pattern. I have WPF window which has reusable usercontrol in his xaml. UserControl consist of WPFDataGrid. Also DataGrid has ContextMenu. I want do some staff when context menu is closed. But ContextMenu class have not dependency property which give me ability to know is it close or not. I cannot farw...

Should I register ViewModels in Container?

Should I register ViewModels in Container and resolve from there? Benefits: I can perform some actions when view model is activated Container will inject dependencies for me ??? Drawbacks: ViewModel lifetime management can be tricky: if I make ViewModel singleton then I can't instantiate several controls of the same type if I mak...

Does this violate the Liskov substitution principle, and if so, what do I do about it?

Use case: I'm using data templates to match a View to a ViewModel. Data templates work by inspecting the most derived type of the concrete type provided, and they don't look at what interfaces it provides, so I have to do this without interfaces. I'm simplifying the example here and leaving out NotifyPropertyChanged, etc., but in the r...

Caliburn.Micro and WebServiceResult

I'm looking for the correct version of this class for Caliburn.Micro public class WebServiceResult : IResult where T : new() The above signature is from the ContactManager example in the full Caliburn framework. It does not cut and paste directly into a Micro-based project. There are too many missing classes to use this directly. Thoug...

In C# and WPF, can you bind an element of an array to an objects property?

For example, is it possible to bind a Textblock's Text property to an element Name[2] of type String? ...

Choosing between bound ViewModel properties or messaging to communicate between ViewModel and View using the MVVM Light Toolkit

I'm using MVVM Light toolkit (which I love). I currently have messaging in place for some interaction originating from the ViewModel and intended for consumption by the View. Typically these types of messages indicate the View should do something like hide itself, show a confirmation message that data was saved, etc. This works. In t...

DevExpress WPF grid bound to List<String> using MVVM

Hi All, I am trying to do something that should be simple, but think I am just not seeing the answer. I have a List with several strings. I would like to bind it to a DevExpress DXGrid. It appears that the grid is showing the correct number of row, but not displaying my text. I am using the MVVm patern and have seperated my ViewMode...

telerik gridview in silverlight using mvvm

I am using teleriks gridview in an mvvm silverlight project. I am struggling to get the editing of a row working. If I double click a cell I am able to change the text of that row. I have a command for a save button. but when I look at my ObservableCollection prog I do not see the changes. so I went and changed everything from observable...

Cross fire with Messenger system between ViewModels causes Problems...

I have a DateNavigatorViewModel + DateNavigatorView on my ButtonBar. Below are 2 Views which get exchanged: DailyView and WeeklyView. Each View has a DailyViewModel and WeeklyViewModel. In my DateNavigatorViewModel I have messenger.Send(SelectedDate); In my DailyViewModel and WeeklyViewModel each register in the constructor: messenge...

PureMVC and Navigation with Silverlight (C#) for Windows Phone 7 (WP7)

I've used PureMVC before with AS3, and am playing around with WP7 so thought it would make sense to try the C# port (http://trac.puremvc.org/PureMVC_CSharp/) The problem I'm having is that the samples (Login/Employee Admin) don't use the NavigationService to change states within the application - they simply hide/show controls when need...

ViewModel in Class project

I'm building a WPF application which is based on the MVVM pattern. Later on we are going to build a Silverlight application of the same type, and also a Web application. I want to use my ViewModels in all three UI:s, so my idea was to move the vm:s to a class library, but then I lost my ICommands, is there an easy way to get around t...

MVVM. Is adding code to View justified in some cases?

I have a View which has a list of items bound to my ViewModel (MVVM pattern). Let's say it looks like that: <ScrollViewer Width="Auto" Height="Auto"> <ItemsControl ItemsSource="{Binding Path=MessageLog}" Grid.IsSharedSizeScope="True" ScrollViewer.CanContentScroll="True"> ...

RegisterType<> Not visible on Silverlight

I was following an example found here on StackOverflow, and everything went well until I need to register my types. My web application is running on Silverlight 4, with Prism and MVVM. The example is using "Microsoft.Practices.Unity" (it's a windows form application) Bootstrapper.cs protected override void ConfigureContainer() ...

Proper way to expose third party visual control in MEF

What is the proper way to do that? Let's say we have some third party library in our project and we need to provide an access to some controls which are sealed. New widgets will be created and added to the application using MEF and they should be able to import some controls from the core application. So how to export those controls prop...

What would be a clever design for layered panels ?

Hi there I would like to design a light "members listing/editing" app in one and only window. My guess was that the best and simplest way to achieve this would be to have the "listing" part (mostly a datagridview and some search stuff) on a panel, and the "editing" (new member or modify member) on another, each panel hiding the other d...

MVVM ViewModel and static methods

Hi everybody! I try to rewrite my Application using the MVVM pattern. I have a window to show related documents for different objects with static methods like this: public partial class ShowRelatedDocuments : Window { private ShowRelatedDocuments() { InitializeComponent(); } public static void ShowRe...

Using IDataErrorInfo or any similar pattern for propagating error messages

Hi all, I apologise for this question as it is rather fuzzy and there are several questions integrated but as they are so closely related I did not want to break them apart into several submissions. I am currently thinking about how to test for configuration errors in an application. There are different options available and one whic...