<Window x:Class="Demo.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Demo.ViewModel" Title="Demo" Height="768" Width="1024" Loaded="OnWindowsLoaded" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"> <Window.DataContext> <local:CompanyViewModel/> //here am getting object reference not set error. </Window.DataContext> </Window>
public partial class MainWindow : Window { CompanyViewModel CompVM; //this is my viewmodel public MainWindow() { InitializeComponent(); CompVM = (CompanyViewModel)base.DataContext; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)