mvvm

WPF MvvM DataGrid variable Columns through a IList of columns

Hi all, I am searching about how to create variable number of columns in a DataGrid from the Ilist in MVVM way. The requirement I am working on is very big and also the number of rows and columns are not known But I did not find satisfactory answers Is there some one that had to do the samething ? If there is no way of generating suc...

Where does the navigation logic belong, View, ViewModel, or elsewhere?

I a button in a view, bound to an ICommand property of the ViewModel (actually it's RelayCommand from mvvv-light) If the user clicks on the button I want to navigate to a new view. Of course the NavigationService is part of the View not the ViewModel. That implies that the navigation is the responsibility of the View? But in my case,...

Is Events Bubbling pattern applicable to hierarchical model?

Lets consider following example, I have "Document" object which contains collection of "Person" objects and each "Person" object has collection of "Address" objects. When one of the "Address" object changes I need to call server-side method to calculate optimal path between all addresses of a person(whose "Address" was changed) and updat...

Property not bound correctly in ListBox DataTemplate

I've been having some trouble getting a listbox to correctly bind to a collection. I'll give the framework code, then explain what I want it to do. XAML Markup: <ListBox DataContext="{Binding Foos, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" ...

Dynamic tab control in WPF/mvvm

Hi, I am following wpf/mvvm method. I need to have a tab control...with multiple rows..i mean parent/child rows. When user click on a tab, all child tabs under that should be displayed...but only the page under one child tab should be loaded. Can anyone help me regarding this please? ...

How to get data using ListView Binding via MVVM in wpf ?

i try to use generate MVVM pattern using Silverlight ListView. But if i bind data my silverlight control no data visualize. also no error return. i see empty gridview. Model: MyData.cs public class MyData { public int ID { get; set; } public string Name { get; set; } public string Price { get; set; } ...

Where does "Non-Click" Behaviour fit into a MVVM Application?

I can expose ICommands from my ViewModels but where does Non-Click/Command behaviour fit into a MVVM Application? eg. Drag & Drop, Hover etc ...

Using MVVM Foundation Messenger to Show Dialog

i have read the other question here on StackOverflow. I understand how to create messages between ViewModels/Objects. But I dont get how can i actually display a dialog. Can I see some code samples implementing this? ...

MVVM: How to design a window hosting different applications?

I am trying to implement a simple WPF data analysis application using the MVVM design pattern, in which one can use several different methods to analyse some data (loaded from files). In the first screen, the user should be able to choose the method he likes to employ. After he has done that, and loaded the data, the area previously occ...

ObservableCollection with ObservableCollections not rendering correctly.

I am relatively new to the Silverlight experience and am trying to create a MVVM app with a DomainService that returns POCOs as the models. I have a UserControl that has a TreeView with the ItemsSource set to bind to an ObservableCollection of a type that has an ObservableCollection as one of it's properties, and that collection is of a ...

Can or should dataforms be nested

My VM looks something like this: public class PersonViewModel : ViewModelBase { public String Name { get; set; } public Phone HomePhone { get; set; } public Phone OfficePhone { get; set; } public Mailing HomeAddress { get; set; } } Of course the view model implements INotifyPropertyChanged and so the property setters i...

wpf app crashes when BackgroundWorker is used

hello, my view model creates a BackgroundWorker in its constructor. BackgroundWorker updates the model's properties from its DoWork event handler. The code below is a contrived example (ViewModelBase is taken almost verbatim from the MVVM paper). public class MyViewModel : ViewModelBase { public int MyProperty { get ...

Winform->WPF MVVM Keybinding Error?

I need some assistance in getting WPF KeyBindings working when being called from a WinForm application. I've created what I think is the basic parts to demonstrate the problem. I can provide an sample application if that helps. The WinForm application starts a form which has a button that calls the WPF Private Sub Button1_Click(ByVal ...

Any Code Samples for MVVM Closable Tabs Example?

I am looking for the code samples or the sample project for the MSDN: MVVM Design Pattern for WPF tutorial. Something similar is fine. I just want to see how I can add/remove tabs dynamically and where commands go ...

MVVM: Does the ViewModel format the data it gets from the model?

I'm a little confused about MVVM. I understand the concept and can see the advantages. My problem is: does the ViewModel pass data directly from the model. For example, let's say I have a "User" model with a findByName() method. The ViewModel would call this in order to pass the relevant user details to the view. The model would likel...

How to enable scroll for nested controls when parent is disabled?

I have lots of nested controls in the panel and I want to disable all of them, but leave scrolls enabled. Basically, I'm setting IsEnabled property of the root element (panel) to false using binding. But this disables scroll as well. Any ideas (except adding IsEnabled to each control instead)? I'm using MVVM. So, in code it looks like t...

Print WPF Visuals with MVVM pattern

My ViewModel has a PrintCommand executing a Method called PrintCalendar(). But the Calendar aka datagrid is in the View, so how do I get my datagrid into the ViewModel? Getting my hands dirty and do all that stuff in code-behind? oh no... PrintDialog printDlg = new PrintDialog(); printDlg.PrintVisual(datagrid, "Grid Printing."); ...

Is it possible to cache the view when using model first approach?

In our product, we use MVVM model first approach and it works nicely but with one caveat. When view becomes complex it takes time to create it from the data template. If the view is shown and hidden frequently, it becomes slightly irritating. If using view first, it would be easy enough to cache a view if needed - but when using DataTemp...

WPF ListView SelectedValue not being set

I've looked at a few solutions but nothing has worked yet for me. I'm using MVVM for this project and have a ListView that I can't set the SelectedItem property. If this is my (simplified) XAML. <ListView Name="uxPackageGroups" ItemsSource="{Binding Path=PackageGroups, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" BorderThicknes...

Looking for a good WPF solution for a transparent, click-through overlay

I want to try something different, and am attempting to display an overlay on top of my current WPF GUI that allows the user to still interact with the GUI, but provides a layer of annoyance to let them know that something's up. My question is really two separate questions: 1. How would you do the overlay? My first attempt was to use...