Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Business object for WPF data grid
Message
From
21/07/2009 08:02:41
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01412628
Message ID:
01413518
Views:
74
Llmar,

You will need to move your code that references controls below the method call to InitializeComponent. The controls are referenced before they are created.
Tim

>I've simplified the project, basically its only the mmBusinessWindow with an instance of the DataGrid on it. I've set the columns and their data sources in Expression Blend (essentially following the Dev Guide's "Data Binding WPF Controls" section. The codebehind code is now simply this:
>
>
>   public partial class MyJokesWindow : mmBusinessWindow
>    {
>        private Humor Humor;
> 
>        /// <summary>
>        /// Constructor
>        /// </summary>
>        public MyJokesWindow()
>        {
>            this.Humor = (Humor)this.RegisterBizObj(new Humor());
>            //this.Window.DataContext = this.Humor.GetMyJokesByPunchline("test");
>            // the above gives: "Object reference not set to an instance of an object."
>            //this.Window.DataContext = this.Humor.GetAllEntities();
>            //this.grdMyJokes.ItemsSource = this.Humor.GetMyJokesByPunchline("test");
>            //and above gives the same error
>          //  this.grdMyJokes.ItemsSource = this.Humor.GetAllEntities();
>            //and above gives the same error
>            this.InitializeComponent();
>        }
>    }
>
>
>But all the commented out variations of trying to retrieve the entity list above result in the same error:
>"Object reference not set to an instance of an object."
>
>The method being called returns a set of entity objects, and works fine in the business object.
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform