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

[Solved] Checkbox in GridView Grouper Row

6 Answers 191 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.
Senthilraja
Top achievements
Rank 1
Senthilraja asked on 15 Oct 2010, 06:14 PM
I need to bind the checkbox and radio button in gridview grouper header.

Group All           Checkbox              Radiobutton1    Radiobutton2
   Group1           Checkbox              Radiobutton1    Radiobutton2
Row1         Checkbox              Radiobutton1    Radiobutton2
   Group2           Checkbox              Radiobutton1    Radiobutton2
Row1         Checkbox              Radiobutton1    Radiobutton2

1. All checkbox should be checked/unchecked when you check/uncheckthe group all checkbox.
2. Same as the child level.

Please help me to implement the above features using MVVM.

Thanks in advance.

6 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 21 Oct 2010, 12:48 PM
Hello Senthilraja,

Basically, in order to result in the template you require for the GridViewGroupRow, you need to predefine its GroupHeaderTemplate and then set the exposed style as the GroupRowStyle for the grid you want.
For example:

<UserControl.Resources>    
    <DataTemplate x:Key="GroupHeaderTemplate">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <StackPanel Grid.Column="0" Orientation="Horizontal">                  
                <TextBlock Text="{Binding Header}" />
                <TextBlock Text=" GroupAll: "/>
                <CheckBox Checked="CheckBox_Checked" />
                <TextBlock Text=" RadionButton1: " />
                <RadioButton />
                <TextBlock Text=" RadionButton2: " />
                <RadioButton />
            </StackPanel>              
        </Grid>
    </DataTemplate>
 
    <Style x:Key="GridViewGroupRowStyle1" TargetType="telerik:GridViewGroupRow">
        <Setter Property="GroupHeaderTemplate" Value="{StaticResource GroupHeaderTemplate}"/>
    </Style>           
</UserControl.Resources>

<telerik:RadGridView Name="playersGrid"         
           GroupRowStyle="{StaticResource GridViewGroupRowStyle1}"
    ItemsSource="{Binding Players}" />   
 
However, I would need a bit more information about the expected behavior so that I could provide you with further suggestions for the implementation of the functionality. Do you want to have different GroupRows depending on the level of grouping, meaning for the first level to have a row with GroupAll-CheckBox and on the inner groups to have another template ? Do you want to bind the RadioButton-s to some propertis ? Do you want them to be in the same group ?  


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
Senthilraja
Top achievements
Rank 1
answered on 22 Oct 2010, 05:27 PM
Hi Maya

Thanks for your late reply... I implemented this feature by using Hierarchical Grid.


Thanks & Regards
Senthil
0
hebboy
Top achievements
Rank 1
answered on 03 Mar 2011, 02:00 PM
Hi, Maya

I want to have different GroupRows depending on the level of grouping. when I check the checkbox in the first level group, I want all the checkboxs in the sencond level group and in the rows to be checked. How can I do that?

Thanks a lot.,
0
Rossen Hristov
Telerik team
answered on 03 Mar 2011, 02:03 PM
Hi hebboy,

I am afraid that what you would like to achieve would be impossible. Thank you for your understanding.

Kind regards,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
hebboy
Top achievements
Rank 1
answered on 03 Mar 2011, 02:29 PM
Hi Ross, 
 Maybe I didn't express what I want. Just like this example of this topic, I want to realize the functions like that:

Group All           Checkbox        TopGroupTitle      
   Group1           Checkbox        SecondLevelGroupTitle      
Row1         Checkbox 
Row2        Checkbox                 
   Group2           Checkbox       SecondLevelGroupTitle        
Row3         Checkbox
Row4         Checkbox    
Row5        Checkbox    

1. When I check/uncheck the checkbox in the top group, all checkboxs in the second level groups and in the rows should be checked/unchecked .
2. When I chekc/uncheck the checkbox in the second level group, all checkboxs in rows of this second group should be checked/unchecked .
3. The TopGroupTitle and the SecondLevelGroupTitle are diffrent.

How can I do that.
Thanks.


0
Rossen Hristov
Telerik team
answered on 03 Mar 2011, 02:31 PM
Hi hebboy,

You can't do that.

Greetings,
Ross
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Senthilraja
Top achievements
Rank 1
Answers by
Maya
Telerik team
Senthilraja
Top achievements
Rank 1
hebboy
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or