2

I have function that return list of strings from database. I want to show those results in wpf ribbon menu.

I think that I need to use RibbonComboBox with RibbonGalleryCategory and bind RibbonGalleryItem somehow to show resulats from db.

Code of my db function looks like that:

    public List<String> GetSeanceListName()
    {
        List<String> seanceList = new List<String>();
        seanceList = (from s in Db.Seance
                          where s.Date >= DateTime.Today
                      select s.Name).ToList();

        return seanceList;
    }

Any help here much appreciated!

Marta
  • 2,857
  • 13
  • 46
  • 67
  • Cassandra have a look at this one, hopefully helps: http://stackoverflow.com/questions/6700696/bind-ribboncombobox-selectionboxitem – Davide Piras Sep 05 '11 at 20:41
  • 2
    possible duplicate of [How to Data Binding RibbonComboBox?](http://stackoverflow.com/questions/5237319/how-to-data-binding-ribboncombobox) – Davide Piras Sep 05 '11 at 20:41
  • Thanks for help! And yes you are right - it seems like a duplicate. Answer from this question worked for me too. – Marta Sep 06 '11 at 07:24

1 Answers1

0

This should work in your case:

<ribbon:RibbonComboBox IsEditable="True">
   <ribbon:RibbonGallery>
       <ribbon:RibbonGalleryCategory ItemsSource="{Binding}" Name="seanceList"/>
    </ribbon:RibbonGallery>
</ribbon:RibbonComboBox>
Marta
  • 2,857
  • 13
  • 46
  • 67