How do I set a ViewModel on a window in XAML using DataContext property?

Posted by Nicholas on Stack Overflow See other posts from Stack Overflow or by Nicholas
Published on 2011-01-04T03:43:12Z Indexed on 2011/01/04 3:53 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

The question pretty much says it all.

I have a window, and have tried to set the DataContext using the full namespace to the ViewModel, but I seem to be doing something wrong.

<Window x:Class="BuildAssistantUI.BuildAssistantWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    DataContext="BuildAssistantUI.ViewModels.MainViewModel">

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf