Response from Marc [XCeed tech support] below. I have implemented the solution accordingly, and, yes - it works ;-)
1) I would like be able to filter the second column
(Speakers) just like the first row (Event name). Right now, the Excel-like
filtering (drop down on the column header) displays a list of distinct values,
but when I click one of these, no filter is applied.
> This will require you to redo the AutoFilterControl
style and handle the filtering. Here is the default template of the
AutoFilterControl in one of the blogs that Michel posted:
http://xceed.com/CS/blogs/techside/archive/2011/11/08/adding-a-select-all-button-the-autofiltercontrol.aspx
This should help you when handling the filtering.
2) I would also like the filter row to work for the
second column. Ie. if the user enters "Alf", all items with Alfred as
the speaker are shown. "ny" will show all with Benny as speaker,
given the current data set.
> In order to achieve this, you will need to supply
your own FilterCell editor and handle the TextChanged event on the TextBox.
Then you must do a refresh so that the Filter event can get triggered. In the
Filter event, you can check if the value of your object contains the string in
the TextBox.
XAML
-----------
<DataTemplate>
<xcdg:FilterRow Background="LightYellow" >
<xcdg:FilterCell FieldName="Speakers">
<xcdg:FilterCell.FilterEditorTemplate>
<DataTemplate>
<TextBox
Background="Yellow" BorderThickness="0"
TextChanged="TextBox_TextChanged"/>
</DataTemplate>
</xcdg:FilterCell.FilterEditorTemplate>
</xcdg:FilterCell>
</xcdg:FilterRow>
</DataTemplate>
-----------
C#
-----------
string lastText = "";
private void TextBox_TextChanged(object sender,
TextChangedEventArgs e) {
lastText =
(sender as TextBox).Text;
(dataGridControl1.ItemsSource as DataGridCollectionView).Refresh();
}
private void DataGridCollectionViewSource_Filter(object
sender, FilterEventArgs e) {
foreach (var
speaker in (e.Item as Event).Speakers)
{
if
(speaker.Name.Contains(lastText))
{
e.Accepted = true;
return;
}
}
e.Accepted =
false;
}
-----------