mvvm

How can I bind an ObservableCollection of ViewModels to a MenuItem?

When I bind Menu Items with an ObservableCollection, only the "inner" area of the MenuItem is clickable: In my View I have this menu: <Menu> <MenuItem Header="Options" ItemsSource="{Binding ManageMenuPageItemViewModels}" ItemTemplate="{StaticResource MainMenuTemplate}"/> </Menu> Then I bind it with this D...

How to modules in Prism (CAL) communicate with each other?

I've got a WPF application which uses the MVVM pattern throughout, no code-behind, the ViewModels communicate with each other through the MainViewModel which gets injected into each of them. Eventually, this application needs to be incorporated into an application which uses Composite Application Library, Unity, etc. Looking through the...

User Interface Interaction with the MVVM

I did some googling and didn't find an answer to this puzzle. Provided you have the following: MySuperView MySuperViewModel MySuperView has two textboxes both bound to string properties on the ViewModel and your using a DelegateCommand to bind your 'Save' button to the ViewModel using syntax such as: ViewModel: this.SaveOrderComm...

General checklist of things that have to know when converting a WPF app to MVVM

Hi, I'm taking an vanilla WPF application and converting it to use the MVVM pattern. During my evaluation of the code, I made up a list of topics that I'd need to know about before converting the application. My list looks kinda like this: dynamically loading xaml (although this is specific to my app) binding xaml to view model comman...

How to ease the transition from WinForms to WPF

I'm working on a large Winforms application dealing with large amounts of data exposed through grids. I see us eventually moving completely to an M-V-VM & WPF implementation but now we're still closer to a ball-of-mud than anything resembling loose coupling. As we evolve toward cleaner separation of concerns, what are some specific patt...

Pushing read-only GUI properties back into ViewModel

I want to write a ViewModel that always knows the current state of some read-only dependency properties from the View. Specifically, my GUI contains a FlowDocumentPageViewer, which displays one page at a time from a FlowDocument. FlowDocumentPageViewer exposes two read-only dependency properties called CanGoToPreviousPage and CanGoToNex...

Generally Preferred Method for a 'Wait' Screen using MVVM and Silverlight

I'm moving along on a small proof of concept application. This is mostly to beef up my MVVM skills within Silverlight. I came across an interesting problem today that I could not figure how to solve the MVVM way. I wasn't successful finding anything relevant during search either. So on to the problem, I have a simple business type app...

Silverlight DataGrid.Celltemplate Binding to ViewModel

Hi. I am in the process of implimenting the MVVC pattern and am having trouble binding a property in the viewmodel from within a DataTemplate within a datagrid. If I have a textblock outside the DataTemplate in the column it works fine (since I am directly referencing the datacontext of the UserConrol, i.e. the VM) however from within t...

WPF MVVM Cancel Edit

How can I implement cancelation of editing an object using MVVM. For example: I have a list of customers. I choose one customer an click the button "Edit", a dialog window(DataContext is binded to CustomerViewModel) opens and I start editing customer's fields. And then I decide to cancel editing, but the fields of the customer have been...

How to make add a fade-in/fade-out animation based on ViewModel property value?

I have a ViewModel which exposes the string property PageToolBarVisible which can be true or false: private string _pageToolBarVisible; public string PageToolBarVisible { get { return _pageToolBarVisible; } set { _pageToolBarVisible = value; OnPropertyChanged("PageToolBarVisible"); } } ...

MVVM WPF Application Developer skill set

Hi, What kind of skills should a WPF developer know to create MVVM applications? Things like Attached Dependency Properties and DelegateCommands. Thanks! ...

How to get View element to fade in/out based on value of ViewModel property?

The View and ViewModel listed below show two buttons: when you click Show ToolBar, the toolbar fades in when you click Hide ToolBar, the toolbar fades out However, the following things don't work: when the application is loaded and OnPropertyChanged("PageToolBarVisible") is fired, if the value is false then the Toolbar shows in spi...

Is this a good case for use of RoutedCommand?

I have a WPF page that has 2 ContentControls on it. Both of the ContentControls have an image, one being much smaller than the other. When mouse over the larger image I want to show a zoomed in view on the smaller image. Something very similar to this: http://www.trekbikes.com/us/en/bikes/urban/soho/soho/. I think I want the larger...

PasswordBox with MVVM

Hi people stackoverflow. I'm working with MVVM, I have ViewModel call UserViewModel with a Property Password. In the View have a control PasswordBox. <PasswordBox x:Name="txtPassword" Password="{Binding Password}" /> But this xaml don't work. How do you do the binding?? Help please!! ...

How have you successfully implemented MessageBox.Show() functionality in MVVM?

I've got a WPF application which calls MessageBox.Show() way back in the ViewModel (to check if the user really wants to delete). This actually works, but goes against the grain of MVVM since the ViewModel should not explicitly determine what happens on the View. So now I am thinking how can I best implement the MessageBox.Show() functi...

How can I specify resources in an MVVM view model?

Suppose I want to show list of objects where each object should have a name and a suitable image (for example MenuItems with Icons, or buttons with text and image). All examples and programs exposed the image in the viewmodel as a path to a PNG file and then bound the Source of an Image to that. But what if I want to use vector images (...

Now can I get a View to instantiate another View that appears above it like a DialogueBox?

I just completed a "dialogue-box solution" for my WPF/MVVM application in which the ViewModel changes its ViewModel properities, and the View uses triggers to accordingly display and hide the dialogue box, etc. From a UX experience it is satisfactory. However, the "dialogue box" that I use is a Border element which gets its Visibility p...

Setting User Control's DataContext from Code-Behind

This should be pretty easy, but it throws VS2008 for a serious loop. I'm trying out WPF with MVVM, and am a total newbie at it although I've been developing for about 15 years, and have a comp. sci. degree. At the current client, I am required to use VB.Net. I have renamed my own variables and removed some distractions in the code b...

Is MVVM really useful?

I have read the MSDN article on MVVM and I am not really convinced. If the model already implements INotifyPropertyChanged/INotifyCollectionChanged, what's wrong with the View binding directly against the Model? It seems the extra ModelView introduces some code without much benefit. Am I missing something? ...

Silverlight 3 Validation MVVM WCF EF

My application is SL2 reading and writing data through an Entity Framework Model exposed via WCF. We have resisted writing any UI validation due to the exicting new validation controls coming from SL3. ...However after doing a trial update on our project yesterday, we realised that most of the standard practices for attaching validation...