WPF datagrid New item placeholder for empty collection

WPF datagrid New item placeholder for empty collection

Old forum URL: forums.lhotka.net/forums/t/8757.aspx


RickR posted on Saturday, April 03, 2010

I have a CSLA-like class that I bind to a WPF toolkit DataGrid.  I do not normally allow editing in a grid, but I have a new application where that makes sense.  When the collection that I bind to is empty, the new item placeholder does not appear.  When the collection has rows, it does.  I have read about this issue and it appears that the datagrid cannot determine the type of object in the collection. Since they are all strongly typed, I'm wondering why this is the case.

As a work-around I can add a new object to the collection, set datagrid.CanUserAddRows = True, and remove the new object. Then the new item placeholder does appear.

I'm wondering if this is also an issue with CSLA?  I have Expert VB 2008, although right now I am out of town and do not have access so I am not sure if this is addressed.

Regards, Rick

My base class is like this:

Public MustInherit Class BusinessListBase(Of T As BusinessListBase(Of T, C), C As {Core.BusinessBase})

  Inherits ObservableCollection(Of C)

and the actual class that I bind to is like this:

Public Class CustomTagList

  Inherits BusinessListBase(Of CustomTagList, CustomTag)

Public Class CustomTag

  Inherits BusinessBase(Of CustomTag)

Copyright (c) Marimer LLC