RadDateTimePicker not abiding by RadDataForm.Mode

5 posts, 1 answers
  1. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 17 Dec 2012 Link to this post

    I have a RadDataForm that contains a number of fields.

    When I add a DataFormDateField and bring up the form in ReadOnly mode, the field is disabled.  When I add a DataFormDataField that contains a RadDateTimePickerand bring up the form in ReadOnly mode, the field is not disabled.

    In other words, this works:
    <telerik:DataFormDateField
        Label="Contact Date"
        DataMemberBinding="{Binding Path=contactdt}"
        />

    And this does not:
    <telerik:DataFormDataField
        Label="Contact Date"
        >
        <telerik:RadDateTimePicker
            SelectedValue="{Binding Path=contactdt}"
        />
    </telerik:DataFormDataField>

    Is there a way to get a DataFormDataFields contained controls to respond to the form's Mode?
  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 18 Dec 2012 Link to this post

    Hello Jeffrey,

    You can try binding IsReadOnly property of RadDateTimePicker to a property in your ViewModel for example and update its value (true/ false) on BeginningEdit and EditEnded events.  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 18 Dec 2012 Link to this post

    That will work.  I was just hoping for something less verbose.
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 24 Dec 2012 Link to this post

    Hi Jeffrey,

    Just as a quick follow-up, another possible way to go (if appropriate) would be to define editing control as follows:

    <telerik:RadDateTimePicker SelectedDate="{Binding Established}"
                                                       IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource AncestorType=telerik:DataFormDataField}}"/>


    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  6. Jeff
    Jeff avatar
    64 posts
    Member since:
    Dec 2011

    Posted 27 Dec 2012 Link to this post

    Clever.
Back to Top
UI for WPF is Visual Studio 2017 Ready