If I set up time any value differs from 0:00 and then try to select day in the next month

calendar skip this month and go to the next.
For example, if I try select date November 8, 2015 selected date will be December 6, 2015.
We have two changes (current month is October): one in November and one in Decmber.
It happend becouse date changing twice: one time when mouse down occurs and one when occurs mouse up. The result view is:

In the text field we see the correct month,

but in the calendar view there is December.

What can I do?
Comments: ** Comment from web user: wizzard2012 **
I found how to overcome this bug!
private bool _isMouseDown; //mouse button is pressed
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
if( _popup != null )
_popup.Opened -= Popup_Opened;
_popup = GetTemplateChild( PART_Popup ) as Popup;
if( _popup != null )
_popup.Opened += Popup_Opened;
if (_calendar != null)
{
_calendar.SelectedDatesChanged -= Calendar_SelectedDatesChanged;
_calendar.PreviewMouseDown -= Calendar_PreviewMouseDown;
_calendar.PreviewMouseUp -= Calendar_PreviewMouseUp;
}
_calendar = GetTemplateChild( PART_Calendar ) as Calendar;
if( _calendar != null )
{
_calendar.SelectedDatesChanged += Calendar_SelectedDatesChanged;
_calendar.PreviewMouseDown += new MouseButtonEventHandler(Calendar_PreviewMouseDown);
_calendar.PreviewMouseUp += new MouseButtonEventHandler(Calendar_PreviewMouseUp);
_calendar.SelectedDate = Value ?? null;
_calendar.DisplayDate = Value ?? DateTime.Now;
}
_timePicker = GetTemplateChild( PART_TimeUpDown ) as TimePicker;
}
void Calendar_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
_isMouseDown = true;
}
void Calendar_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
_isMouseDown = false;
}
protected override void OnValueChanged( DateTime? oldValue, DateTime? newValue )
{
if( _calendar != null && _calendar.SelectedDate != newValue )
{
_calendar.SelectedDate = newValue;
if (!_isMouseDown) // we do not need to update dispay if mouse is pressed
_calendar.DisplayDate = newValue ?? DateTime.Now;
}
base.OnValueChanged( oldValue, newValue );
}