c# - object reference is not set to an instance of an object repository -


I'm getting an XAMLParseException that is actually covering an exception. Here is part of the Stacktrace:
Message = Object references are not set to an instance of an object. Source = Assignment Organizer - StackTrace: In the Assetment Organizer. Manvindo .. C: \ Users \ Mohit \ Documents \ Visual Studio 2010 \ Projects \ AssignmentOrganizer \ AssignmentOrganizer \ MainWindow.xaml.cs: Line 29
Here the row is 29:

 < Code> lvwMain .emsSource = _assignmentRepo.ListAssignments ();  

Where lvwMain is a ListView and _assignmentsRepo is an IAssignmentRepository as announced:

  IAssignmentRepository _assignmentRepo;  

This is where the error occurs. I am using a repository pattern which is ready to guess?
Here is my XML:

  & lt; Window x: Class = "Assignment Organizer. Manvindo" xmlns = "http: // Schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns: x = "http://schemas.microsoft.com/winfx/2006 / Xaml "xmlns: toolkit =" http://schemas.microsoft.com/wpf/1008/toolkit "title =" main window "height =" 518 "width =" 755 "& gt; & Lt; DockPanel & gt; & Lt; Menu DockPanel.Dock = "Top" & gt; & Lt; / Menu & gt; & Lt; Toolbar DockPanel.Doc = "Top" & gt; & Lt; / Toolbar & gt; & Lt; StatusBar DockPanel.Dock = "Down" & gt; & Lt; / StatusBar & gt; & Lt; Grid dockpanel.doc = "left" width = "150" & gt; & Lt; Grid.RowDefinitions & gt; & Lt; Roadfinion height = "25 9 *" /> & Lt; Roadfinion height = "25 9 *" /> & Lt; /Grid.RowDefinitions> & Lt; / Grid & gt; & Lt; Grid Dock Panel. Doc = "right" width = "150" & gt; & Lt; / Grid & gt; & Lt; Grid & gt; & Lt; ListView x: name = "lvwMain" & gt; & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn header = "title" width = "125" /> & Lt; GridViewColumn Header = "Reason" width = "75" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt; & Lt; / Grid & gt; & Lt; / DockPanel & gt;  

In your constructor, make sure that you Initial component Call any other constructor reasoning before calling.

  Public MainWindow () {// Make it the first time. InitializeComponent (); // Now do the rest constructor ... lvwMain.ItemsSource = _assignmentRepo.ListAssignments (); ...}  

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -