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

CustomFilterDescriptor on rowdetails

2 Answers 102 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Margie
Top achievements
Rank 1
Margie asked on 16 Jun 2010, 04:48 PM
I need to know how to use a customfilterdescriptor on the rowdetails of a RadGridView.
The xaml is as follows:

 
 <telerikPresentation:RadGridView Margin="0,2,0,5" 
                                             x:Name="rgvQuestions" 
                                             AutoGenerateColumns="False" 
                                             ShowGroupPanel="False" 
                                             RowEditEnded="rgvQuestions_RowEditEnded"    
                                             ScrollViewer.VerticalScrollBarVisibility="Auto"   
                                             ScrollViewer.HorizontalScrollBarVisibility="Auto"   
                                             BeginningEdit="rgvQuestions_BeginningEdit" 
                                             ToolTipService.ToolTip="Double click cell to edit.">  
                <telerikPresentation:RadGridView.Columns> 
                    <telerikPresentation:GridViewDataColumn Header="Id" 
                        DataMemberBinding="{Binding Id, Mode=OneWay}" 
                        IsReadOnly="True" /> 
                    <telerikPresentation:GridViewDataColumn Header="Question Text" 
                        DataMemberBinding="{Binding QuestionText, Mode=TwoWay}" /> 
                    <telerikPresentation:GridViewDataColumn Header="Active" 
                        DataMemberBinding="{Binding Active, Mode=TwoWay}" /> 
                </telerikPresentation:RadGridView.Columns> 
                <telerikPresentation:RadGridView.HierarchyChildTemplate > 
                    <DataTemplate> 
                        <StackPanel> 
                            <TextBlock Text="Attributes" 
                                       FontSize="14" 
                                       Foreground="Black" /> 
                            <telerikPresentation:RadGridView x:Name="rgvAttributeDetails" 
                                                             AutoGenerateColumns="False" 
                                                             ShowGroupPanel="False" 
                                                             DataContext="{x:Null}" 
                                                             Loaded="rgvAttributeDetails_Loaded" 
                                                             ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                                             ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                                                             RowDetailsVisibilityMode="VisibleWhenSelected">  
                                <telerikPresentation:RadGridView.Columns> 
                                    <telerikPresentation:GridViewColumn> 
                                        <telerikPresentation:GridViewColumn.CellTemplate> 
                                            <DataTemplate> 
                                                <Button x:Name="btnAddDeleteAttributes" 
                                                    Content="Add/Delete" 
                                                    Click="btnAddDeleteAttributes_Click" /> 
                                            </DataTemplate> 
                                        </telerikPresentation:GridViewColumn.CellTemplate> 
                                    </telerikPresentation:GridViewColumn> 
                                    <telerikPresentation:GridViewDataColumn Header="Attribute Name" 
                                        DataMemberBinding="{Binding Key, Mode=OneWay}" 
                                        IsReadOnly="True" /> 
                                </telerikPresentation:RadGridView.Columns> 
                                <telerik:RadGridView.RowDetailsTemplate> 
                                    <DataTemplate> 
                                        <StackPanel> 
                                            <ListBox x:Name="lbAttributeValues" 
                                                     ItemsSource="{Binding Value}" /> 
                                        </StackPanel> 
                                    </DataTemplate> 
                                </telerik:RadGridView.RowDetailsTemplate> 
                            </telerikPresentation:RadGridView> 
                            <TextBlock Text="Answers" 
                                       FontSize="14" 
                                       Foreground="Black" /> 
                            <telerikPresentation:RadGridView x:Name="rgvAnswers" 
                                                             AutoGenerateColumns="False" 
                                                             ShowGroupPanel="False" 
                                                             CanUserInsertRows="True" 
                                                             ShowInsertRow="True" 
                                                             DataContext="{x:Null}" 
                                                             Loaded="rgvAnswers_Loaded"   
                                                             RowEditEnded="rgvAnswers_RowEditEnded" 
                                                             ScrollViewer.VerticalScrollBarVisibility="Auto" 
                                                             ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                                                             BeginningEdit="rgvAnswers_BeginningEdit" 
                                                             ToolTipService.ToolTip="Double click cell to edit.">  
                                <telerikPresentation:RadGridView.Columns> 
                                    <telerikPresentation:GridViewColumn> 
                                        <telerikPresentation:GridViewColumn.CellTemplate> 
                                            <DataTemplate> 
                                                <Button x:Name="btnDeleteAnswer" 
                                                    Content="Delete" 
                                                    Click="btnDeleteAnswer_Click" /> 
                                            </DataTemplate> 
                                        </telerikPresentation:GridViewColumn.CellTemplate> 
                                    </telerikPresentation:GridViewColumn> 
                                    <telerikPresentation:GridViewDataColumn Header="Id" 
                                        DataMemberBinding="{Binding AnswerId, Mode=OneWay}" 
                                        IsReadOnly="True" /> 
                                    <telerikPresentation:GridViewDataColumn Header="Answer Text" 
                                        DataMemberBinding="{Binding AnswerText, Mode=TwoWay}" /> 
                                    <telerikPresentation:GridViewDataColumn Header="Correct" 
                                        DataMemberBinding="{Binding Correct, Mode=TwoWay}" /> 
                                </telerikPresentation:RadGridView.Columns> 
                            </telerikPresentation:RadGridView> 
                        </StackPanel> 
                    </DataTemplate> 
                </telerikPresentation:RadGridView.HierarchyChildTemplate> 
            </telerikPresentation:RadGridView> 
            <telerikPresentation:RadDataPager x:Name="rdpQuestions" 
                                              Source="{Binding Items, ElementName=rgvQuestions}" 
                                              PageSize="10" 
                                              DisplayMode="All" 
                                              IsTotalItemCountFixed="False" /> 

The grid is bound to a Dictionary<string,List<string>>. I bound the row template to the key and put the list in a Listbox as the row details. I would like to filter by values contained in the List.

Here is the method I currently have: 

 

 

 

 

 

public CustomFilterDescriptor QuestionFilterDescriptor  
        {  
            get 
            {  
                if (m_CustomFilterDescriptor == null)  
                {  
                    m_CustomFilterDescriptor = new CustomFilterDescriptor(((RadGridView)rgvQuestions.ChildrenOfType<RadGridView>()[0]).Columns.OfType<GridViewDataColumn>());  
                    ((RadGridView)rgvQuestions.ChildrenOfType<RadGridView>()[0]).FilterDescriptors.Add(m_CustomFilterDescriptor);  
                      
                }  
                return m_CustomFilterDescriptor;  
            }  
        } 

 

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 17 Jun 2010, 09:11 AM
Hello Brian Collins,

Can you please open a separate support ticket and send us a runnable sample project. Also, tell us the exact way that you want to filter, because we are not sure what you mean.

Thanks in advance.

All the best,
Ross
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
Rossen Hristov
Telerik team
answered on 17 Jun 2010, 09:44 AM
Hi Brian Collins,

By the way, in case you want to do a simple filtering like on the Count of the list, this could be possible.

But in case you want to apply some kind of complex condition on the child entities in the list, this will be a lot harder.

You might need to create some expressions and predicates like described in this blog post.

Sincerely yours,
Ross
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
Tags
GridView
Asked by
Margie
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or