I need to know how to use a customfilterdescriptor on the rowdetails of a RadGridView.
The xaml is as follows:
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:
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; |
} |
} |