Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Unanswered Creating a Custom Control from Normal DatePicker

  • Wednesday, May 23, 2012 4:17 PM
     
     

    I've got an issue with a custom control created from the normal DatePicker.  The control was created with a silverlight project and the binding occurs within the XAML of the control.  When I point to the custom control from within a collection the data populates correctly within the control.  However whenever I first click on the little calendar icon next to the text input field the calendar does not drop down next to the field, but instead appears in the top left of the screen and a message box pops that says, "Value does not fall within the expected range".  If I close the message box and select a date from the calendar popup in the top left of screen everything works as expected.  If I click the text box of the control next to the calendar icon to select the date and then click the calendar icon nothing appears to happen.  If I click the icon a second time the calendar will pop down properly.  Has anyone else had this issue or can offer suggestions on correcting the control?  Thank you for any assistance.

All Replies

  • Thursday, May 24, 2012 9:15 AM
     
     
    In my experience, the Silverlight datepicker does not work well with Lightswitch - the border won't show, and the calendar icon usually doesn't show up until you click where it should be.  I made a custom control for a UTC datetime picker, and eventually had to give up on Silverlight's datepicker/timepicker and force it to use Lightswitch's one.

    Free Visual Studio LightSwitch extensions: Elyl's Extensions http://visualstudiogallery.msdn.microsoft.com/bbe013bf-45b6-46c4-ba13-537cc23c5118

  • Thursday, May 24, 2012 2:13 PM
     
      Has Code

    Hi

    I don't know why you binding the custom control within XAML of the control. Please see the below image in my case i am using DevExpress calendar control. But i wrote the code within <ScreenName>_Activated.

    here is my sample code.

    IContentItemProxy orderdatefrom = this.FindControl("OrderDateFrom");
    orderdatefrom.SetBinding(DevExpress.Xpf.Editors.DateEdit.EditValueProperty, "Screen.OrderDateFrom", System.Windows.Data.BindingMode.TwoWay);

    The detail demonstration you can found from here.

    You must read this article first.

    Hope this help you...


    Rashmi Ranjan Panigrahi


    • Edited by babloo1436 Thursday, May 24, 2012 2:16 PM
    •  
  • Thursday, May 24, 2012 6:35 PM
     
     

    Hi Babloo1436,

    When I use the DevExpress DateEdit control with the binding in the _Activated the control works (Also had to change the string of binding to "Value" rather than "Screen.OrderDateFrom").  However when I try to use the normal SL5 DatePicker or one based on it (ComponentOne C1DateTimePicker), the control fails whenever I click on the control.  I'm VS 11 Beta, SL5, LS2, Windows 7 64bit.  I have tried building the control in VS10, SL4, LS1, Windows 7 64bit with the same results.  I've tried it as a seperate project custom control (wanting this to set additional XAML parms), and the way you indicate binding in the _Activated code... still bombs with the error box of "Value does not fall within the expected range".  I'm at a standstill as the DevExpress does not support blacklisted dates which was the goal of the custom control I was needing.

  • Thursday, May 24, 2012 8:16 PM
     
     

    Hi

    1. First of all if you are using VS 11 Beta then you have to use SL5 control.

    2. For every third party control the binding property is different. Here for DevExpress the binding property is EditValueProperty, similarly for Telerik the binding property is SelectedDateProperty. So I think for C1DateTimePicker it should be different. I suggest you to kindly verify the binding property for C1DateTimePicker from its Online documentation. 

    What error you are getting when you integrating DevExpress control ?

    Regards


    Rashmi Ranjan Panigrahi

  • Friday, May 25, 2012 2:10 PM
     
     

    Hi

    I do not receive any errors when using the DevExpress DateEdit control, however it does not have blacklisting dates ability.  The error I receive when I try to use a custom control based on the normal DatePicker control is as follows:

    The exact same program using the DevExpress DateEdit control works fine.  It has to be something with the normal DatePicker SL5 control.  Thank you for your time and suggestions.

    David


    • Edited by msdnmoss Friday, May 25, 2012 2:11 PM
    •