Binding to an IFilteringControl Custom Filter Control.

1 Answer 90 Views
GridView
Martin
Top achievements
Rank 2
Iron
Iron
Iron
Martin asked on 06 Aug 2021, 10:55 AM

I've made a YearRange custom filtering control that expose a DependencyProperty called Vintage

<telerik:GridViewDataColumn Width="110" DataMemberBinding="{Binding ModelVariant.Vintage}" Header="Ã…rgang">
  <telerik:GridViewDataColumn.FilteringControl>
    <local:CustomGridFilter Vintage="{Binding ElementName=root, Path=VintageYear, Mode=TwoWay}" />
  </telerik:GridViewDataColumn.FilteringControl>
</telerik:GridViewDataColumn>

 public int? Vintage
        {
            get { return (int?)GetValue(VintageProperty); }
            set { SetValue(VintageProperty, value); }
        }

        public static readonly DependencyProperty VintageProperty =
            DependencyProperty.Register(
                "Vintage",
                typeof(int?),
                typeof(CustomGridFilter),
                new PropertyMetadata(
                    null,
                    (sender, evt) => { ((CustomGridFilter)sender).OnPropertyChanged("Vintage"); }
                )
            );

Apparently the property never changes (INotifyPropertyChanged) even though it's databound to a property on the container. 

So i suspect that the only other way to send a new filtering parameter to the Custom Filter Control is through other means ?

Or is this SUPPOSED to work ? 

How would i programatically send the new filtering parameter to the control ?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 11 Aug 2021, 07:26 AM

Hello Martin,

Thank you for the provided code snippet.

I have tested your scenario but wasn't able to reproduce the described behavior. You can check the attached project which I think mimics your implementation. When you run the project, change the value in the TextBox below the RadGridView. Then open the filter on the last column. You can see that there is a TextBlock at the bottom of the filter which has the same value as the TextBox. Can you check it out and let me know what I am missing for your set-up?

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Martin
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or