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

Filter's style and behavior is same as in winForm

10 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
cx
Top achievements
Rank 1
cx asked on 15 Apr 2011, 04:20 AM
Hi all,

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

Sort by
0
Vlad
Telerik team
answered on 15 Apr 2011, 07:19 AM
Hello,

 You can find similar example here

Regards,
Vlad
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
cx
Top achievements
Rank 1
answered on 15 Apr 2011, 09:16 AM
Hi Vlad,

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
0
Vlad
Telerik team
answered on 15 Apr 2011, 09:50 AM
Hello,

 Have you checked the code of the demo?

All the best,
Vlad
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
cx
Top achievements
Rank 1
answered on 15 Apr 2011, 09:54 AM
Yes, I check the demo code.
But it does not work on my side, it so strange. Could you give me a sample app for Custom filter row? Thanks

0
cx
Top achievements
Rank 1
answered on 15 Apr 2011, 11:54 AM
I create a fresh wpf project , put custom filter row demo's file into this project, It doesn't work as well.

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

0
cx
Top achievements
Rank 1
answered on 16 Apr 2011, 02:16 PM
Hello,

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
0
cx
Top achievements
Rank 1
answered on 22 Apr 2011, 03:55 AM
Hello,

Nobody can help me? It's importment for me to solve this issue .

Thanks
0
Vanya Pavlova
Telerik team
answered on 22 Apr 2011, 09:35 AM
Hello Cx,

 
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
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
cx
Top achievements
Rank 1
answered on 25 Apr 2011, 11:54 AM
Hi Vanya,

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
0
Vanya Pavlova
Telerik team
answered on 25 Apr 2011, 12:04 PM
Hello Cx,

 
Please take a look at the following blog post for further reference.

Best wishes,
Vanya Pavlova
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
cx
Top achievements
Rank 1
Answers by
Vlad
Telerik team
cx
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or