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

[Solved] GridView Group by Column by hide Visibility

6 Answers 479 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Angie
Top achievements
Rank 1
Angie asked on 21 Jul 2010, 08:31 PM
Hi

What i would like to do is Hide the visibility of data in a Column but keep the associated grouping in the gridview. I don't want to see repeated product name in the grid View. I have attached a jpg to explain more. What i don't want to see is the part which is crossed off by red. Would i be able to do this using Silverlight Grid View

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 22 Jul 2010, 06:48 AM
Hello Ravindranath,

If you define the GroupDescriptor like:

<telerik:RadGridView.GroupDescriptors>
    <telerik:GroupDescriptor Member="Position" />
</telerik:RadGridView.GroupDescriptors>

Then you can just set the Property of the column - IsVisible to "False"
<telerik:GridViewDataColumn DataMemberBinding="{Binding Position}"                                             IsVisible="False"/>

 

All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Angie
Top achievements
Rank 1
answered on 01 Sep 2010, 10:41 PM
is there a way to make group descriptors click able hyperlink buttons. Something like in the picture i attached
0
Maya
Telerik team
answered on 02 Sep 2010, 07:29 AM
Hi Ravindranath,

You can define the GroupHeaderTemplate and set its DataTemplate as follows:

<telerik:RadGridView.GroupHeaderTemplate>
     <DataTemplate>
        <HyperlinkButton Content="{Binding Header}" Click="HyperlinkButton_Click"/>
     </DataTemplate>
</
telerik:RadGridView.GroupHeaderTemplate>

Afterwards, in case you require this button to open the group for example, you may handle its Click event like:
private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
{
    HyperlinkButton hyperlinkButton = e.OriginalSource as HyperlinkButton;
    GridViewGroupRow groupRow = hyperlinkButton.ParentOfType<GridViewGroupRow>();
    if(groupRow != null)
    {
        this.clubsGrid.ExpandGroup(groupRow.Group);
    }          
}

 


Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Angie
Top achievements
Rank 1
answered on 02 Sep 2010, 05:05 PM
I already did that but that didn't work i couldn't get the hyperlink buttons to be visible. For some reason its not binding to the button. Here is the code i used. I also have attached two images of before adding GroupHeader Template and after adding HeaderTemplate. I could also send the whole project if you want. Let me know

<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" x:Class="TestSilverlightApplication.MainPage"
xmlns:telerikGridView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView"
xmlns:telerikData="clr-namespace:Telerik.Windows.Data;assembly=Telerik.Windows.Data"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">

<telerik:RadGridView x:Name="grdHistory"  
                                          CanUserFreezeColumns="False" AutoExpandGroups="True" ShowGroupPanel="True" AutoGenerateColumns="False"
                                         ItemsSource="{Binding AgentHistory}" >
<telerikGridView:RadGridView.Columns>
<telerikGridView:GridViewDataColumn     Header="Name" DataMemberBinding="{Binding Name}" 
                                                          IsReadOnly="True" IsGroupable="True" IsFilterable="True" IsVisible="True"/>
<telerikGridView:GridViewDataColumn  Header="Agent" DataMemberBinding="{Binding Agent}" Width="600"
                                                                 IsFilterable="True" IsGroupable="True" IsReadOnly="True"/>
</telerikGridView:RadGridView.Columns>

<telerikGridView:RadGridView.GroupDescriptors>
<telerikData:GroupDescriptor Member="Name"/>
</telerikGridView:RadGridView.GroupDescriptors>

<telerikGridView:RadGridView.GroupHeaderTemplate>
<DataTemplate>
<HyperlinkButton Content="{Binding Name}"/>
</DataTemplate>
</telerikGridView:RadGridView.GroupHeaderTemplate>

</telerik:RadGridView>

</Grid>
</UserControl>
0
Maya
Telerik team
answered on 02 Sep 2010, 05:14 PM
Hi Ravindranath,

 
You need to change the Binding in the Content Property of the HyperlinkButton:

<telerik:RadGridView.GroupHeaderTemplate>
    <DataTemplate>
        <HyperlinkButton Content="{Binding Header}"/>
    </DataTemplate>
</telerik:RadGridView.GroupHeaderTemplate>


All the best,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Angie
Top achievements
Rank 1
answered on 02 Sep 2010, 05:20 PM
Nice That works. Thanks alot.
Tags
GridView
Asked by
Angie
Top achievements
Rank 1
Answers by
Maya
Telerik team
Angie
Top achievements
Rank 1
Share this question
or