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">
You need to instantiate the MainViewModel and set it as datacontext. In your statement it just consider it as string value.
In addition to the solution that other people provided (which are good, and correct), there is a way to specify the ViewModel in XAML, yet still separate the specific ViewModel from the View. Separating them is useful for when you want to write isolated test cases.
In App.xaml:
In MainWindow.xaml:
You might want to try Catel. It allows you to define a DataWindow class (instead of Window), and that class automatically creates the view model for you. This way, you can use the declaration of the ViewModel as you did in your original post, and the view model will still be created and set as DataContext.
See this article for an example.
Try this instead.