DataGrid.SetCurrentItemToPlaceholder() -- oddity?

Jul 6, 2009 at 11:50 AM
Edited Jul 7, 2009 at 1:15 PM
Why doesn't this method use EditableItems.CurrentAddItem? (i.e. CurrentItem = EditableItems.CurrentAddItem)
        private void SetCurrentItemToPlaceholder()
        {
            NewItemPlaceholderPosition position = EditableItems.NewItemPlaceholderPosition;
            if (position == NewItemPlaceholderPosition.AtEnd)
            {
                int itemCount = Items.Count;
                if (itemCount > 0)
                {
                    CurrentItem = Items[itemCount - 1];
                }
            }
            else if (position == NewItemPlaceholderPosition.AtBeginning)
            {
                if (Items.Count > 0)
                {
                    CurrentItem = Items[0];
                }
            }
        }
I am trying very hard to figure out how to implement the IEditableCollectionView interface (see http://wpf.codeplex.com/Thread/View.aspx?ThreadId=60656) and this caught my eye while stepping through the code.
My understanding is that the new item (before being committed) does not have to exist in the underlying list itself. However, SetCurrentItemToPlaceholder() seem to make the opposite assumption.
I guess I will have to yield (once I figure out what makes the new item row appear in the first place), but would be nice if someone could steer me in the right direction here.
--
Rune