This project has moved. For the latest updates, please go here.

NumericUpDown and DateTimeUpDown dataset binding

Jan 18, 2013 at 7:58 PM
Edited Jan 18, 2013 at 7:58 PM

Hi All.

I would like to binding DateTimeUpDown to dataset table and validate if field is empty. My code:

<toolkit:DateTimeUpDown Name="CallTimeUpDown" Grid.Column="3" HorizontalAlignment="Left" 
     Format="Custom" FormatString="hh:mm tt" Value="08:30" Width="75">
      <Binding Path="CallTime" NotifyOnValidationError="True" >
              <Binding.ValidationRules>
                     <local:RequiredString ObjectType="String"  />
              </Binding.ValidationRules>
      </Binding>
</toolkit:DateTimeUpDown>

But when I coded like this I got error messge: The type 'DateTimeUpDown' does not support direct content.

How to fix that problem?

Thanks.

Jan 19, 2013 at 1:04 PM

You are implicitly trying to bind the Content property while you should be binding the Value property instead. So while not having looked too close at your code this (not tested) should work:

<toolkit:DateTimeUpDown Name="CallTimeUpDown" Grid.Column="3" HorizontalAlignment="Left" 
     Format="Custom" FormatString="hh:mm tt" Value="08:30" Width="75">
    <toolkit:DateTimePicker.Value>
      <Binding Path="CallTime" NotifyOnValidationError="True" >
              <Binding.ValidationRules>
                     <local:RequiredString ObjectType="String"  />
              </Binding.ValidationRules>
      </Binding>
   </toolkit:DateTimePicker.Value>
</toolkit:DateTimeUpDown>

Jan 21, 2013 at 4:06 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.