Windows Vista Forums

ItemTemplate for an empty collection
  1. #1


    OgreFX Guest

    ItemTemplate for an empty collection


    Is there a way to define a template for ListBox to appear when ItemsSource
    is set to an empty collection? E.g. I want to show "No entries" text if the
    result of a DB query is empty set.

    Thanks,
    -O.



      My System SpecsSystem Spec

  2. #2


    Laurent Bugnion, MVP Guest

    Re: ItemTemplate for an empty collection

    Hi,

    OgreFX wrote:

    > Is there a way to define a template for ListBox to appear when ItemsSource
    > is set to an empty collection? E.g. I want to show "No entries" text if the
    > result of a DB query is empty set.
    >
    > Thanks,
    > -O.
    Yes, you can use a Style with a DataTrigger observing the collection you
    set to the ItemsSource, and setting the "Template" property to something
    else if the Count is 0.

    HTH,
    Laurent
    --
    Laurent Bugnion [MVP ASP.NET]
    Software engineering, Blog: http://www.galasoft.ch
    PhotoAlbum: http://www.galasoft.ch/pictures
    Support children in Calcutta: http://www.calcutta-espoir.ch

      My System SpecsSystem Spec

ItemTemplate for an empty collection problems?

Similar Threads
Thread Thread Starter Forum Replies Last Post
(Empty) 'New' menu, empty start menu, BRAND NEW VISTA! kikiluna General Discussion 6 27 Dec 2008
Vista explorer - Folder empty, but is not empty, why? Sandra Baum Vista General 0 14 Dec 2008
Help with the collection contains method Tanzen .NET General 7 19 Jun 2008
file folder icons display non-empty folders as empty nodaway Vista file management 1 26 Dec 2007
ListBox ItemTemplate Wrapping and others Jan Kucera Avalon 0 07 Nov 2006