Thanks, Sid.
I'm trying to register the business object in my window1.xaml.cs file: The code behind file for my main XAML window.
I put the register call in the Window_Initialized event handler because the registration needs to happen before any datasources are bound, which has happened by the time the Window_Loaded event handler has fired. I tried putting a call to InitializeComponent() in the Window_Loaded handler. The registration happens well before that and ALWAYS fails in exactly the same way:
"Object reference not set to an instance of an object." Here is the trace stack:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="OakLeaf.MM2008.WPF"
StackTrace:
at OakLeaf.MM.Main.WPF.mmBusinessWindow.CreateUIHelper()
at OakLeaf.MM.Main.WPF.mmBaseWindow.get_UIHelper()
at OakLeaf.MM.Main.WPF.mmBusinessWindow.get_BusinessUIHelper()
at OakLeaf.MM.Main.WPF.mmBusinessWindow.RegisterPrimaryBizObj(mmBusinessObject businessObject)
at EWB_Prototype.Window1.mainWindow_Initialized(Object sender, EventArgs e) in E:\Projects\whiteboard\Sandbox\Lynn\version0.02\EWB_Prototype\Window1.xaml.cs:line 53
at System.Windows.FrameworkElement.RaiseInitialized(EventPrivateKey key, EventArgs e)
at System.Windows.FrameworkElement.OnInitialized(EventArgs e)
at System.Windows.FrameworkElement.TryFireInitialized()
at System.Windows.FrameworkElement.EndInit()
at System.Windows.Markup.BamlRecordReader.ElementEndInit(Object& element)
InnerException:
Here is part of my code:
namespace EWB_Prototype
{
public partial class Window1 : mmBusinessWindow
{
private Patient pPatient;
public String savedLayout = "";
public String _targetItem = null;
private XamDataGrid sourceGrid;
public String rootpath;
public string fnSchedule = null;
public static ArrayList openTherapistCards = new ArrayList();
public static ArrayList openPatientCards = new ArrayList();
public static ArrayList openAideCards = new ArrayList();
public static string newStatus = "";
public static String path = Directory.GetCurrentDirectory();
private void mainWindow_Initialized(object sender, EventArgs e)
{
this.pPatient = (Patient)this.RegisterPrimaryBizObj(new Patient());
fnSchedule = ConfigurationManager.AppSettings["Schedule"];
}
private void XamRibbonWindow_Loaded(object sender, RoutedEventArgs e)
{
String path = Directory.GetCurrentDirectory();
int loc = path.IndexOf("\\bin");
rootpath = path.Substring(0, loc);
Any ideas from anyone would be greatly appreciated.
Thanks!
Lynn 8-)
Lynn Sim
Perot Systems Corp