This is a migrated thread and some comments may be shown as answers.
Group Header not showed with GroupStyle
4 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 27 Jan 2017, 09:29 AM

Hi to all,

I configured a Listbox with single Group, but if I change a GroupStyle, Group item not longer appears.

my XAML/C# code is this, and I attached a screenshots (where I put a red rectangle, it not shows my value), where I wrong?

01.FastSearchItems = new ObservableCollection<FastSearchItem>();
02.var view = new CollectionViewSource();
03.view.GroupDescriptions.Add(new PropertyGroupDescription(propertyName: "Tipo"));
04.view.Source = FastSearchItems;
05.FastSearchItemsFound = view;
06. 
07.//Add several items
08.FastSearchItems.Add(new FastSearchItem(/*parameter values*/));
09.//[..]
01.<telerik:RadListBox x:Name="FastSearchRadListBox" ItemsSource="{Binding FastSearchItemsFound.View}"
02.                    Grid.Row="2" Width="300" Grid.Column="2"
03.                    MouseDoubleClick="FastSearchRadListBox_MouseDoubleClick"
04.                    VerticalAlignment="Top"
05.                    Height="400" Visibility="{Binding FastSearchIsDropDownOpen,Converter={StaticResource VisibilityConverter}}"
06.                    ScrollViewer.VerticalScrollBarVisibility="Auto"
07.                    ScrollViewer.HorizontalScrollBarVisibility="Disabled">
08.    <telerik:RadListBox.ItemsPanel>
09.        <ItemsPanelTemplate>
10.            <StackPanel Orientation="Vertical" />
11.        </ItemsPanelTemplate>
12.    </telerik:RadListBox.ItemsPanel>
13.    <telerik:RadListBox.ItemTemplate>
14.        <DataTemplate>
15.            <StackPanel>
16.                <TextBlock Text="{Binding Caption}" />
17.            </StackPanel>
18.        </DataTemplate>
19.    </telerik:RadListBox.ItemTemplate>
20.    <telerik:RadListBox.GroupStyle>
21.        <GroupStyle>
22.            <GroupStyle.HeaderTemplate>
23.                <DataTemplate>
24.                    <StackPanel Orientation="Vertical" Background="#FAFAFA">
25.                        <TextBlock Text="{Binding Caption}" FontWeight="Bold"/>
26.                    </StackPanel>
27.                </DataTemplate>
28.            </GroupStyle.HeaderTemplate>
29.        </GroupStyle>
30.    </telerik:RadListBox.GroupStyle>
31.</telerik:RadListBox>

4 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 01 Feb 2017, 07:49 AM
Hello Dario,

I have tested the provided code, but everything works as expected at our side - the group header is shown with Xaml and NoXaml assemblies. Could you try to create a sample app demonstrating the erroneous behavior and send it to us? You should open a support ticket and attache it there.

Regards,
Yana
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Nicholas
Top achievements
Rank 1
answered on 25 Apr 2020, 04:05 PM

Hello,

I am experiencing the same issue that Dario was.

I am able to use a CollectionViewSource to group my listbox successfully. However, as soon as I try to set the template of the header, the text disappears, regardless of what color/size/weight of the font.

The header is still present, because the space is there and when I change the font size the gap for the group header changes. But as long as I have a header template set, I am unable to actually see the ListBox group header.

Dario, if you were able to resolve this issue, would you mind sharing your solution with me?

Here is my XAML:

Thanks

<telerik:RadListBox.GroupStyle>
    <GroupStyle>
        <GroupStyle.HeaderTemplate>
            <DataTemplate>
                <StackPanel Height="30" Margin="0 5 0 5">
                    <TextBlock Text="{Binding DrillTank}" FontWeight="Bold"/>
                </StackPanel>
            </DataTemplate>
        </GroupStyle.HeaderTemplate>
    </GroupStyle>
</telerik:RadListBox.GroupStyle>
0
Vladimir Stoyanov
Telerik team
answered on 29 Apr 2020, 12:42 PM

Hi Nicholas,

Thank you for the shared pictures. 

Can you check out the following thread: ListBox Groupstyle display: How to design a group name?, where a similar question was discussed? Note, that it is for the native ListBox control, however it should be applicable for the RadListBox as well. 

I hope you find this helpful.

Regards,
Vladimir Stoyanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Nicholas
Top achievements
Rank 1
answered on 29 Apr 2020, 01:14 PM

Hello Vladimir,

That explanation makes perfect sense and solved my problem immediately. I appreciate your help.

Thank you!

Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Yana
Telerik team
Nicholas
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or