Store complex type value

2 posts, 0 answers
  1. Sotiris
    Sotiris avatar
    1 posts
    Member since:
    Mar 2011

    Posted 18 Mar 2011 Link to this post

    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?


            Public Property BeginDate() As Date?


                    Return _beginDate

                End Get

                Set(ByVal value As Date?)

                    _beginDate = value


                End Set

            End Property



            Private _endDate As Date?


            Public Property EndDate() As Date?


                    Return _endDate

                End Get

                Set(ByVal value As Date?)

                    _endDate = value


                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}" />


    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

  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 18 Mar 2011 Link to this post

    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.

    the Telerik team
  3. DevCraft R3 2016 release webinar banner
Back to Top