Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
Grouping with xamTabControl
posted

Hi, I have a CollectionView for grouping a list of objects.

Now I want to use the xamTabControl, to show the groups on a window with groupnames in Tabheader.

Is it able to do that with the xamTabControl, and how to do?

 

best regards from germany

  • 9694
    Verified Answer
    posted

    I've attached a sample VS2008 WPF project that illustrates one approach to this scenario. In the sample, I created a test data collection. I added a string property called header and made sure that the test data had items with duplicate Header names. I then added a ViewModel and in the ViewModel, I create a collection of collections grouped by Header name. I bound the collection of grouped items to the XamTabControl. Each tab control contains a XamTilesControl which displays each group of items.

    Let me know if this helps.

    Thanks

    TabControlSample.zip
  • 9694
    Suggested Answer
    posted

    Hello Yeti,

    I understand what you want to accomplish. However, I don't see how you can make this work in XAML.

    The XamTabControl is an ItemsControl, which means it does support CollectionView GroupDescriptions to group items into their own sections. The problem with attempting this with a TabControl (WPF and Infragistics) is that the tab item is considered part of the list item, thus you will end up with tabs repeating within their own groups. What you need is to have each tab behave as the header for a group.

    The easy way to support this is to do it in the data Create a collection at run time using LINQ that groups items and bind this to the TabControl. Each item bound to the TabControl would end up as a separate tab item (binding to ItemsSource). You will then need to sort the individual items for each grouped item to be part of the content.

    With a lot of work, this feature may be supported by overriding the control template and being clever with the data. To come up with that type of solution would be as complex as creating a new control from scratch. If anyone else has another idea, please submit it here.

    This idea of supporting groups as separate tabs is an excellent one. Would you be interested in submitting this idea as feature request?

    http://devcenter.infragistics.com/Protected/RequestFeature.aspx

    Sincerely,

    Curtis