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

Filter problem with property binding

1 Answer 45 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Silvio del Balzo
Top achievements
Rank 1
Silvio del Balzo asked on 25 Sep 2009, 02:14 PM
Hi,
first of all I'm sorry for my English.
I'm a new user, I'm trying to binding a fieldFilterDescription property  (value) to Textbox Property (text)
I used an example found in this forum "SilverlightGridCustomFilterRow"
In SilverlightGridCustomFilterRow the binding work well, but in my vb code WPF
the binding don't work.
When I change the textboxproperty don't change the fieldFilterDescription property
   
What's Wrong?

Dim ffd As FieldFilterDescription = Nothing 
 
For Each cell As GridViewHeaderCell In cells 
    Dim column As GridViewDataColumn = DirectCast(cell.Column, GridViewDataColumn) 
    Dim descriptions As IEnumerable(Of FieldFilterDescription) = radGridView.FilterDescriptors.OfType(Of FieldFilterDescription)() 
    ffd = (From fd In descriptions Where fd.FieldName = column.UniqueName Select fd).FirstOrDefault() 
 
    Dim element As FrameworkElement = Nothing 
    element = New TextBox() 
    element.Height = 24 
    element.Margin = New Thickness(3, 3, 3, 5) 
    If ffd IsNot Nothing Then 
       ffd.Filter1.[Operator] = Telerik.Windows.Data.FilterOperator.Contains 
       BindText(element, "Value", ffd.Filter1) 
 
    End If 
next 
 
 
 
Private Sub BindText(ByVal ptextBox As TextBox, ByVal pproperty As String, ByVal source As Object) 
 
            Dim textProp As DependencyProperty = TextBox.TextProperty 
            If Not BindingOperations.IsDataBound(ptextBox, textProp) Then 
                Dim b As Binding = New Binding(pproperty) 
                b.Source = source 
                b.Mode = BindingMode.TwoWay 
                b.Path = New PropertyPath(pproperty) 
                ptextBox.SetBinding(TextBox.TextProperty, b) 
            End If 
 
End Sub 
 

Best regards
Marco

1 Answer, 1 is accepted

Sort by
0
Stefan Dobrev
Telerik team
answered on 30 Sep 2009, 12:11 PM
Hello Silvio,

My suggestion is to use FilterDescriptor instead of FieldFilterDescription. FieldFilterDescription is used for our own internal purpose to create filtering drop down.

You can create a FilterDescriptor and bind its value to the TextBox.Text  property. Then you will need to add this FilterDescriptor to the FilterDescriptors property of RadGridView.

Greetings,
Stefan Dobrev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Silvio del Balzo
Top achievements
Rank 1
Answers by
Stefan Dobrev
Telerik team
Share this question
or