How do I hide group row headings (see attached image) without affecting the group footers?
I am using 2015 Q2.
Thanks,
Howard
12 Answers, 1 is accepted
Thank you for writing.
You can use the ViewCellFormatting event and remove the text:
void
radGridView1_ViewCellFormatting(
object
sender, CellFormattingEventArgs e)
{
if
(e.Row
is
GridViewGroupRowInfo)
{
e.CellElement.Text =
""
;
}
}
Please let me know if there is something else I can help you with.
Dimitar
Telerik
That did not work. All it did was to wipe out the text. I don't want the rows to appear.
I tried e.Height = 0, but that didn't work either.
In previous versions (prior to 2015 Q2) radGridView1.TableElement.GroupHeaderHeight = 0;
Howard
Thank you for writing back.
I have tested this locally and the rows are hidden when the GroupHeaderHeight is set to 0. I have tested this with the latest and the Q1 2015 SP1 versions and the results are the same. This is why I have attached my test project. Could you please check it and let me know how it differs from your real setup?
In addition could you please specify which previous version you have used?
Thank you in advance for your patience and cooperation.
Dimitar
Telerik
Hello,
I have a RadGridView and I'm filtering by making rows not Visible based on checkboxes from another control. This works fine until you drag column header to group. RadGridView shows row headers when there is actually nothing to see when you expand because rows are hidden. I'm trying to use the GroupSummaryEvaluate event to hide the GroupRow if there are no visible rows
int visibleRowCount = 0;
foreach (GridViewRowInfo row in e.Group)
{
if (row.IsVisible)
visibleRowCount++;
}
if (visibleRowCount == 0)
e.Group.GroupRow.IsVisible = false;
else
e.Group.GroupRow.IsVisible = true;
This is sort of working, but i still see GroupRows until i click the down arrow on one of them and then they all vanish, except the ones that actually have visible rows. Am I doing this wrong? Is there a better way?
A secondary problem occurs when you click a filter to add rows back (make then IsVisible = true) in that the group header doesn't come back for visible rows, until the control is ungrouped, then regrouped. Hope this makes sense. Thanks.
You need to hide/show the group rows each time when the filtering or grouping are changed. For example, you can use the FilterChanged or GroupByChanged events. Here is how you can get the group rows:
foreach
(var item
in
radGridView1.ChildRows)
{
if
(item
is
GridViewGroupRowInfo)
{
var groupRow = item
as
GridViewGroupRowInfo;
if
(!groupRow.ChildRows.Where(x => x.IsVisible ==
true
).Any())
{
groupRow.IsVisible =
false
;
}
else
{
groupRow.IsVisible =
true
;
}
}
}
I hope this will be useful. Let me know if you have additional questions.
Regards,
Dimitar
Progress Telerik
You can use the VisualItemFormatting event for this:
private
void
RadListView1_VisualItemFormatting(
object
sender, ListViewVisualItemEventArgs e)
{
var groupItem = e.VisualItem
as
SimpleListViewGroupVisualItem;
if
(groupItem !=
null
)
{
groupItem.ToggleElement.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
}
}
I hope this helps. Should you have any other questions do not hesitate to ask.
Dimitar
Progress Telerik
You can use the MouseDown event to expand/collapse the group on a single click:
private
void
RadListView1_MouseDown(
object
sender, MouseEventArgs e)
{
var group = radListView1.ElementTree.GetElementAtPoint(e.Location)
as
SimpleListViewGroupVisualItem;
if
(group !=
null
)
{
var dataItem = group.Data
as
ListViewDataItemGroup;
dataItem.Expanded = !dataItem.Expanded;
}
}
The hover colors can be changed by editing the theme in Visual Style Builder, detailed information is available in the following articles:
The attached image shows where you can find the hover colors.
We have other control that allows creating such menus: Navigation View.
I hope this helps. Should you have any other questions do not hesitate to ask.
Dimitar
Progress Telerik
Yes the items in navigation view do not support grouping. However you can add your existing RadListView to a Panel and change its width. I have attached a project that shows how this can be implemented.
Do not hesitate to contact us if you have other questions.
Dimitar
Progress Telerik