this.scheduleControl1.Calendar.DateValue = new DateTime(2019, 9, 8);
this.scheduleControl1.Appearance.MonthShowFullWeek = true;
this.scheduleControl1.GetScheduleHost().CurrentCell.MoveTo(2, 7); |
this.scheduleControl1.GetScheduleHost().CurrentCell.MoveTo(4, 7); |
private void btnGoto_Click(object sender, EventArgs e)
{
DateTime date = this.dateTimePicker1.Value;
int monthDiff = date.Month - this.scheduleControl1.Calendar.DateValue.Month;
this.scheduleControl1.Calendar.DateValue = date;
this.scheduleControl1.Calendar.AdjustSelectionsByMonth(monthDiff > 0 ? monthDiff - 1 : monthDiff + 1);
this.scheduleControl1.ResetProvider(this.scheduleControl1.ScheduleType);
var method = this.scheduleControl1.GetScheduleHost().GetType().GetMethod("SetCurrentCellInView", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
if (method != null)
{
this.scheduleControl1.GetScheduleHost().Model.ResetCurrentCellInfo();
method.Invoke(this.scheduleControl1.GetScheduleHost(), new object[] { date });
}
} |
scheduleControl1.Calendar.CalenderGrid.QueryCellInfo += CalenderGrid_QueryCellInfo1;
private void CalenderGrid_QueryCellInfo1(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
DateTime day = this.dateTimePicker1.Value;
DateTime isdate;
if (!string.IsNullOrEmpty(e.Style.CellValue.ToString()) && DateTime.TryParse(e.Style.CellValue.ToString(),out isdate) &&
isdate == day)
{
e.Style.BackColor = this.scheduleControl1.Appearance.NavigationCalendarTodayBackColor;
e.Style.TextColor = this.scheduleControl1.Appearance.NavigationCalendarTodayTextColor;
}
} |
Hi Smart,
Thanks for your update.
We have analyzed the sample and resolved the reported issue. Please find the attached sample and let us know if you have any other queries.
Please replace old code with highlighted changes in your sample.
private void btnGoto_Click(object sender, EventArgs e) { if (this.dateTimePicker1.Value != this.scheduleControl1.Calendar.DateValue) { DateTime date = this.dateTimePicker1.Value; int monthDiff = ((date.Year
- this.scheduleControl1.Calendar.DateValue.Year)
* 12) + date.Month - this.scheduleControl1.Calendar.DateValue.Month; this.scheduleControl1.Calendar.DateValue
= date; this.scheduleControl1.Calendar.AdjustSelectionsByMonth(monthDiff
> 0 ? monthDiff - 1 : monthDiff + 1); var method = this.scheduleControl1.GetScheduleHost().GetType().GetMethod("SetCurrentCellInView",
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic); if (method != null) { this.scheduleControl1.GetScheduleHost().Model.ResetCurrentCellInfo();
method.Invoke(this.scheduleControl1.GetScheduleHost(),
new object[] { date }); } } } |
Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/ModifiedSample2123389811.zip
Let us know whether this helps you and also if you need any further assistance on this.
Regards,
Keerthivasan A.
private void Calendar_DateValueChanged(object sender, EventArgs e)
{
DateTime firstSelectedTime = scheduleControl1.Calendar.SelectedDates[0];
SetViewRangeOfCalendar(firstSelectedTime.Year, firstSelectedTime.Month);
DateSelections SelectedDates = scheduleControl1.Calendar.SelectedDates;
//To update the headertext label
if (SelectedDates[SelectedDates.Count - 1] > scheduleControl1.Calendar.BottomRightDate.AddDays(-1))
{
this.scheduleControl1.Calendar.AdjustSelectionsByMonth(-1);
}
} |