My client requirement is make filter behavior as in winForm( there is one row under column header. there is one textbox and filter button in each column row) for some RadGridView in WPF app. Need still use wpf's RadGridview not host winForm's RadGridview.
If there is a property to set or I should custom RadGridView ? How do I implement it? Thanks
Good luck
zacky
10 Answers, 1 is accepted
You can find similar example here.
Regards,Vlad
the Telerik team

Thanks for you help. I add all necessary code in our app.
The Radgridview is :
<telerik:RadGridView x:Name="gridViewArea"
CanUserInsertRows="True" ShowInsertRow="True"
RowIndicatorVisibility="Visible"
telerikGridViewFilter:CustomFilterRow.IsEnabled="True"
RowDetailsVisibilityMode="Collapsed"
ShowGroupPanel="False" HorizontalAlignment="Stretch" AutoGenerateColumns="False"
CanUserFreezeColumns="False"
AlternateRowBackground="#FFF7F7F7" AlternationCount="2"
CanUserDeleteRows="True" CanUserSelect="True"
ItemsSource="{Binding }" CanUserSortColumns="True"
IsReadOnly="False" Margin="18,29,18,0"
SelectionMode="Single"
CanUserResizeColumns="True" VerticalAlignment="Stretch">
<!--RowDetailsTemplate="{StaticResource AreaDriversRowDetailsTemplate}"-->
<telerik:RadGridView.Columns>
<!--<telerik:GridViewToggleRowDetailsColumn />-->
<telerik:GridViewDataColumn Header="Arder ID" DataMemberBinding="{Binding Path=AreaID}"
IsReadOnly="True" IsSortable="True" Width="80" />
<telerik:GridViewDataColumn Header="Area" DataMemberBinding="{Binding Path=Area1,Mode=TwoWay}"
Width="*" />
</telerik:RadGridView.Columns>
</telerik:RadGridView>
but nothing changed after app start, there is no custom filter row like sample does, what content I missing?
I also create a fresh project add codes from sample, the result also is no filter row.
Thanks
Have you checked the code of the demo?
All the best,Vlad
the Telerik team

But it does not work on my side, it so strange. Could you give me a sample app for Custom filter row? Thanks

In CustomerFilterRow.cs:
private void radGridView_RowLoaded(object sender, RowLoadedEventArgs e)
{
if (e.Row is GridViewHeaderRow)
{
Grid rootPanelGrid = (from c in this.radGridView.ChildrenOfType<Grid>()
where c.Name == "PART_RootPanel"
select c).FirstOrDefault();
if (rootPanelGrid != null && this.filteringRow.Parent == null)
{
rootPanelGrid.Loaded += this.rootPanelGrid_Loaded;
}
while debug to line: if (e.Row is GridViewHeaderRow), it always false

I debug into codes of Telerik Custom Filter Row demo, found that if I change the code in CustomerFilterRow.cs to:
public
CustomFilterRow(RadGridView radGridView)
{
this
.radGridView = radGridView;
this
.radGridView.IsFilteringAllowed =
false
;
this
.radGridView.RowLoaded +=
this
.radGridView_RowLoaded;
this
.radGridView.ColumnDisplayIndexChanged +=
this
.ReorderFilterCells;
this
.radGridView.Grouped +=
this
.Grouped;
this
.radGridView.DataLoaded +=
this
.radGridView_DataLoaded;
this
.filteringRow =
new
FilteringRow();
this
.filteringRow.Loaded +=
this
.FilteringRow_Loaded;
}
private
void
radGridView_DataLoaded(
object
sender, EventArgs e)
{
//this.filteringRow = new FilteringRow();
//this.filteringRow.Loaded += this.FilteringRow_Loaded;
//this.radGridView.RowLoaded += this.radGridView_RowLoaded;
//this.radGridView.ColumnDisplayIndexChanged += this.ReorderFilterCells;
//this.radGridView.Grouped += this.Grouped;
this
.radGridView.DataLoaded -=
this
.radGridView_DataLoaded;
}
the custom filter row can be normally displayed.
But another issue come, the insert row will be replace by custom filter row underGridViewHeaderRow if set radgridview property
CanUserInsertRows="True" ShowInsertRow="True". How can I implement display these two filer row and insert row( insert row need under filter row) at same time?
Thanks in advanced
zacky

Nobody can help me? It's importment for me to solve this issue .
Thanks
I have prepared an example for you that demonstrates how to show the GridViewNewRow below the CustomFilterRow. If you take a look at CustomFilterRow.cs file you may notice that the row is placed in the first row of the main grid, change this value to 0 and you will be able to see the new row, as shown below:
void
rootPanelGrid_Loaded(
object
sender, RoutedEventArgs e)
{
RecalculateIndentPresenterWidth();
Grid rootPanelGrid = sender
as
Grid;
if
(
this
.filteringRow.Parent ==
null
)
{
rootPanelGrid.Children.Add(
this
.filteringRow);
this
.filteringRow.SetValue(Grid.RowProperty,
0
);
}
}
Also you may find attached working project that demonstrates this approach.
Kind regards,
Vanya Pavlova
the Telerik team

Thank you very much. The custom filter row can work now.
I can add enum ColumnHeader(I implement a EnumColumnHeader control) if the column is GridViewComboBoxColumn, but how to binding data for ColumnHeader's comboBox?
for example I want to add custom filter for this column:
<telerik:GridViewComboBoxColumn Header="Payment"
DataMemberBinding="{Binding Path=Payment}" Width="auto"
ItemsSource="{Binding Path=OrderPayment}" />
Best regards
zacky
Please take a look at the following blog post for further reference.
Vanya Pavlova
the Telerik team