This is a migrated thread and some comments may be shown as answers.

Hide Group Header For Empty Group

6 Answers 359 Views
JumpList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Josh
Top achievements
Rank 1
Josh asked on 11 Dec 2011, 12:44 AM
Is there a way to hide the group header if there is not group? My jump list has some items that have a group and some that don't. When they don't, the header is still there, but empty (no text). I am able to make it not show up by changing the GroupHeaderTemplate and changing the visibility to Collapsed when there is an empty group, but it still takes up the same amount of space due to the RadDataBoundListBoxItem

Is it possible to have it completely not show?

Also, it might be ok if the grouping didn't occur if there were no groups. Meaning, I'm grouping by a property and if all properties were null, no grouping would occur. Then I would be ok with their being a blank header because it would only show if there were other grouped headers. Then you could click the empty header and see all the rest.

6 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 12 Dec 2011, 08:19 AM
Hi Josh,

Thanks for writing and for your questions.

In general, RadJumpList does not show group headers for empty groups, i .e. when you are grouping groups are created based on the group key defined for each item. If there are no items for a given group key, there will no be a group for them at all.

However, since it could be that in your particular scenario thinks are organized in another way, we would kindly like to ask you to prepare a sample project that we can use to reproduce the undesired behavior and thus be able to help.

Please note that you will have to open a new support ticket in order to be able to attach your project.

Thanks for your time.

Kind regards,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Josh
Top achievements
Rank 1
answered on 12 Dec 2011, 05:04 PM
There are items for the group, but there is no group for the items. So, I have a list of items. The items have a "category" on them. I'm grouping by the category, but some have null for a cateogry. The ones with null will still have a group heading, it's just empty and takes up space.
0
Accepted
Deyan
Telerik team
answered on 14 Dec 2011, 09:04 AM
Hi Josh,

Thanks for writing back and for clarifying your scenario.

If you remove the group header for the items that have their Category as null, you will still be able to see them as belonging to a group - the previous one.

I suggest you simply give the group of items with no Category a special name that clarifies that these items do not belong to a standard group.

If you however would like to hide their group header, you could handle the ItemStateChanged event of RadJumpList, listen for the Realized state and set the Visibility property of the container (RadDataBoundListBoxItem) to null in case the realized container is mapped to that special empty group. The code would looke something like the following:

private void JumpList_ItemStateChanged(object sender, ItemStateChangedEventArgs e)
{
    if (e.DataItem is DataGroup)
    {
        if ((e.DataItem as DataGroup).Key == null)
        {
            RadDataBoundListBoxItem container = this.jumpList.GetContainerForItem(e.DataItem as DataGroup) as RadDataBoundListBoxItem;
            container.Visibility = Visibility.Collapsed;
        }
    }
}

I hope this helps.

Let me know if you need further assistance here.

Best wishes,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Josh
Top achievements
Rank 1
answered on 20 Dec 2011, 03:48 AM
I ended up using the Silverlight control toolkit's LongListSelector instead. I'm going to mark your reply as the answer though, because hiding the item's container should do the trick. It tried hiding the item, but the container still takes up space.
0
Deyan
Telerik team
answered on 21 Dec 2011, 03:09 PM
Hello Josh,

Thanks for writing back.

We will be very thankful if you give us some further information on how we can improve RadJumpList so that it can be reasonably used in your scenario. Although achieving the behavior that you desire is currently possible, giving us any hints on how we could simplify it will be appreciated.

Thanks for your time.

All the best,
Deyan
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Josh
Top achievements
Rank 1
answered on 21 Dec 2011, 04:42 PM
Allowing for use of the MVVM pattern would be the biggest plus for me. When using the RadJumpList, I need to put a bunch of code in code behind to get it to work. When using the MVVM pattern, this means I need to create a user control that has a view model where I can expose the functionality I need to use.

Allowing for GroupDescriptors and SortDescriptors to be created in XAML would help.

Allowing the control of the items panel in XAML would help. The items panel by default has margin on it, so if you have no item there, it still takes up space. Either let the user be able to control the items panel (via XAML), or let the item template have the control; meaning don't have any styling on the panel and let the item template add the margins if needed.
Tags
JumpList
Asked by
Josh
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Josh
Top achievements
Rank 1
Share this question
or