locked
I need a second pair of eyes on this datagrid problem RRS feed

  • Question

  • I have a datagrid bound to an ObservableCollection(T) with items that implement the INotifyPropertyChanged interface so I am under the assumption that I have everything I need to set up editing in a datagrid. The problem I am having is when I try to add an item to the collection it crashes the application. This really doesn't make sense to me what I am doing wrong so I need some help... (FWIW - I apologize for the horrendous presentation of the code here (this is a forum post after all)). Here is the XAML for the datagrid... Here is the code where I add new items to the list... if (_selectedGameTemplate.FreeRollPrizes == null) _selectedGameTemplate.InitializeFreeRollPrizeList(); //all this does is create a new list on the object containing the list _selectedGameTemplate.FreeRollPrizes.Add(FreeRollGamePrize.CreatePrize(_selectedGameTemplate.FreeRollPrizes.Count + 1)); CustomPrizeDataGrid.ItemsSource = null; CustomPrizeDataGrid.ItemsSource = _selectedGameTemplate.FreeRollPrizes; I know this isn't rocket science and I have done this hundreds of times with other technologies - what the heck am I not seeing here? Thanks!
    Wednesday, August 5, 2009 1:01 AM

Answers

  • Sorry guys I have not been online for awhile and I am just reading these now. I have solved my UI problem and everything is working as expected now. Asif - I am not trying to insult you and please do not take it as an insult but; what is with all the question marks???? Are you trying to talk down to me? If you are going to do that then you need to work on either your grammar or your typing because right now it is almost illegible. If using question marks like this is just something you do - then realize that when you do that, most people who speak English fluently assume you are asking the question in astonishment (as if you are saying "WTF!") and not just asking a simple question. Thanks for you input
    Saturday, August 8, 2009 12:38 PM

All replies

  • What exception do you get?

    Friday, August 7, 2009 11:34 AM
  • Dont u get the add option on ur observable collection????  

     i have done the coding n i m not getting ne error in adding new entry in the observable collection .. i m not using inotifyproperty...  i m using ado.net model n ado.net service for connectivity n using the observable collection in binding it to the datagrid..  at the time of adding i m doing is as follow.. i have created a function and that is as follow:

    void OnAdd(object sender, EventArgs args)

    {

    observCollEmployee.Add(
    new EMPLOYEE_DETAILS());

    dgEmployee.ItemsSource = observCollEmployee;

    }

     

    here observCollEmployee is my observable collection n employee_Details the tablename dat im getting... dgEmployee is the the datagrid which im binding with the observable collection

     

     

    Thanks

    Asif 

     

    Saturday, August 8, 2009 5:05 AM
  • Sorry guys I have not been online for awhile and I am just reading these now. I have solved my UI problem and everything is working as expected now. Asif - I am not trying to insult you and please do not take it as an insult but; what is with all the question marks???? Are you trying to talk down to me? If you are going to do that then you need to work on either your grammar or your typing because right now it is almost illegible. If using question marks like this is just something you do - then realize that when you do that, most people who speak English fluently assume you are asking the question in astonishment (as if you are saying "WTF!") and not just asking a simple question. Thanks for you input
    Saturday, August 8, 2009 12:38 PM
  • hi bitburner,

    sorry my short english has hurt you but let me make u clear that those so many question marks were not to ask d question in astonishment and not at all in d WTF way. sorry to say but I have a habit of writing down words in sort and in hurry same thing happened with the post.   i will make sure that it will not be repeated...

     

    Tuesday, August 11, 2009 2:03 AM
  • It's okay, I was assuming that it was a mistake, and I understand that English can be a *** for those not fluent in it to learn (mostly because of all our metaphors and slang terms). Cheers!
    Tuesday, August 11, 2009 3:30 PM