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

Store complex type value

1 Answer 71 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Sotiris
Top achievements
Rank 1
Sotiris asked on 18 Mar 2011, 04:42 PM

Hi,
I'm very new on working with Telerik products.  The past few days i'm working with RadDataFilter and custom editors but I stuck with the following problem.

My custom editor is a usercontrol witch has a dependency property called SelectedDateRange of type DateRange. The DateRange is a class with two properties

 

Public Class DateRange

        Implements System.ComponentModel.INotifyPropertyChanged

 

#Region "INotifyPropertyChanged Implementation"

        Public Event PropertyChanged(ByVal sender As Object, ByVal e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

        Protected Sub OnPropertyChanged(ByVal propertyname As String)

            RaiseEvent PropertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyname))

        End Sub

#End Region

        Private _beginDate As Date?

        <DataMember()>

        Public Property BeginDate() As Date?

            Get

                Return _beginDate

            End Get

            Set(ByVal value As Date?)

                _beginDate = value

                OnPropertyChanged("BeginDate")

            End Set

        End Property

 

 

        Private _endDate As Date?

        <DataMember()>

        Public Property EndDate() As Date?

            Get

                Return _endDate

            End Get

            Set(ByVal value As Date?)

                _endDate = value

                OnPropertyChanged("EndDate")

            End Set

        End Property

 

        Public Function HasRange() As Boolean

            Return BeginDate.HasValue Or EndDate.HasValue

        End Function

 

    End Class

 

Using your example i'm trying to bind the SelectedDateRange with the Value Property of the FilterDescriptor using the following statement

<DataTemplate x:Key="DateRangeBlockEditor">

            <AhsSysUIControls:DateRangeBlock SelectedDateRange="{Binding Value,Mode=TwoWay}" />

        </DataTemplate>

It seems that this doesn't work as i get always an unsetValue. The bottom line is that i want the FilterDescriptor to carry the DateRange because later i iterate all the FilterDescriptors to create an SQL where statement. Any ideas?

Thanks Sotiris

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 18 Mar 2011, 04:50 PM
Hello Sotiris,

The default Value with which a FilterDescriptor is "born" is the so called UnsetValue, which indicates that the FilterDescriptor is not active. That is perfectly ok.

You can use an IValueConverter in the Binding to transform this UnsetValue to anything that you want, for example null, if your property supports it.

In case your company has purchased licensed version of the controls, please ask the purchaser to add your email to the list of licensed developers so that we can provide you with adequate services and answer your future questions. In that way, you can get access to the support services, the latest hotfixes and downloads from within your account.

Thanks in advance.

Regards,
Ross
the Telerik team
Tags
DataFilter
Asked by
Sotiris
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or