Q:

Problems with data binding on dependency properties

I'm getting an exception telling me "Binding' cannot be set on the 'InitialStartDateTime' property of type 'WinFormsWrapper'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject." but my properties are dependency properties as you can see here, right?
public class WinFormsWrapper : WindowsFormsHost
{       
    /// <summary>
    /// The control element
    /// </summary>
    private static EtDateTimeRange control = new EtDateTimeRange();     

    /// <summary>
    /// The dependency property for InitialStartDateTime
    /// </summary>
    public static readonly DependencyProperty InitialStartDateTimeProperty = DependencyProperty.Register("StartDateTime", typeof(DateTime), typeof(WinFormsWrapper), new FrameworkPropertyMetadata(control.InitialStartDateTime, new PropertyChangedCallback(InitialStartDateTime_Changed)));

    /// <summary>
    /// Handles the event
    /// </summary>
    /// <param name="sender">The sender</param>
    /// <param name="e">The arguments</param>
    private static void InitialStartDateTime_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
    {
        control.InitialStartDateTime = (DateTime)e.NewValue;
    }

    /// <summary>
    /// Gets, sets the InitialStartDateTime
    /// </summary>
    public DateTime InitialStartDateTime
    {
        get { return (DateTime)GetValue(InitialStartDateTimeProperty); }
        set { SetValue(InitialStartDateTimeProperty, value); }
    }

    /// <summary>
    /// The dependency property for InitialEndDateTime
    /// </summary>
    public static readonly DependencyProperty InitialEndDateTimeProperty = DependencyProperty.Register("EndDateTime", typeof(DateTime), typeof(WinFormsWrapper), new FrameworkPropertyMetadata(control.InitialEndDateTime, new PropertyChangedCallback(InitialEndDateTime_Changed)));

    /// <summary>
    /// Handles the event
    /// </summary>
    /// <param name="sender">The sender</param>
    /// <param name="e">The arguments</param>
    private static void InitialEndDateTime_Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
    {
        //_control.InitialEndDateTime = (DateTime)e.NewValue;
    }

    /// <summary>
    /// Gets, sets the InitialEndDateTime
    /// </summary>
    public DateTime InitialEndDateTime
    {
        get { return (DateTime)GetValue(InitialEndDateTimeProperty); }
        set { SetValue(InitialEndDateTimeProperty, value); }
    }
}

and this is my xaml:
<controls:WinFormsWrapper InitialStartDateTime="{Binding StartDateTime}" InitialEndDateTime="{Binding EndDateTime}" />

Thank you in advance!
EDIT: Thanks alot, its running now, but it's still not displaying my control, any ideas why?

A:

You are using the wrong properties in your DependencyProperty creation.
public static readonly DependencyProperty InitialEndDateTimeProperty = DependencyProperty.Register("EndDateTime", typeof(DateTime), typeof(WinFormsWrapper), new FrameworkPropertyMetadata(control.InitialEndDateTime, new PropertyChangedCallback(InitialEndDateTime_Changed)));

In the Register part, it should have been InitialEndDateTime instead of EndDateTime.

A:

 DependencyProperty.Register("StartDateTime", 

You have to Name it 
 DependencyProperty.Register("InitialStartDateTime", 

:)
Same Problem with the EndDateTime
I hope that solves your problem

