this.scheduleControl1.ScheduleType = ScheduleViewType.CustomWeek;
this.scheduleControl1.Calendar.SelectedDates.Clear();
DateTime dt = DateTime.Now;
this.scheduleControl1.Calendar.SelectedDates.AddRange(new DateTime[] { dt, dt.AddDays(1), dt.AddDays(2) });
this.scheduleControl1.GetScheduleHost().SetDataToDayPanels(); |
private void scheduleControl1_ScheduleAppointmentClick(object sender,ScheduleAppointmentClickEventArgs e)
{
if (e.ClickType == ScheduleAppointmentClickType.LeftDblClick &&this.scheduleControl1.ScheduleType == ScheduleViewType.CustomWeek)
{
IScheduleAppointment item = e.Item;
int colIndex = this.scheduleControl1.GetScheduleHost().CurrentCell.ColIndex;
int panel = GetUseTableFromCol(colIndex);
bool exist = true;
if (item == null)
{
item = this.scheduleControl1.DataSource.NewScheduleAppointment();
exist = false;
item.StartTime = e.ClickDateTime;
item.EndTime = e.ClickDateTime;
this.scheduleControl1.GetScheduleHost().ShowAppointmentForm(item, exist, panel);
e.Cancel = true;
}
}
} |
Hi Mohanraj,
I can see a fixed view of custom week in the schedule control. And, I cannot find navigate buttons in caption panel. Is it possible to navigate weeks in this view?
Thanks,
Mohit Saxena
foreach (Control con in this.scheduleControl1.CaptionPanel.Controls)
{
if (con is ThemedScrollButton)
{
ThemedScrollButton button = con as ThemedScrollButton;
button.Click += button_Click;
}
}
void button_Click(object sender, EventArgs e)
{
ThemedScrollButton button = sender as ThemedScrollButton;
if (button.Text == "<")//Move to previous week
{
this.MoveInDirection(false);
}
else if (button.Text == ">") //Move to week forward
{
this.MoveInDirection(true);
}
//Hide display all day events row.
this.scheduleControl1.GetScheduleHost().RowHeights[1] = 1;
}
private void MoveInDirection(bool forward)
{
if (this.scheduleControl1.ScheduleType == ScheduleViewType.CustomWeek)
{
DateTime dt = this.scheduleControl1.Calendar.SelectedDates[0];
int count = this.scheduleControl1.Calendar.SelectedDates.Count;
dt = dt.AddDays(forward ? count : -count);
this.scheduleControl1.Calendar.DateValue = dt;
AdjustSelectedDatesByWeek();
//Remove the current cell selection while navigating.
this.scheduleControl1.GetScheduleHost().CurrentCell.MoveTo(-1, -1);
}
}
private void AdjustSelectedDatesByWeek()
{
int count = this.scheduleControl1.Calendar.SelectedDates.Count;
this.scheduleControl1.Calendar.SelectedDates.BeginUpdate();
DateTime theDate = this.scheduleControl1.Calendar.DateValue;
this.scheduleControl1.Calendar.SelectedDates.Clear();
while (count > 0)
{
this.scheduleControl1.Calendar.SelectedDates.Add(theDate);
theDate = theDate.AddDays(1);
count--;
}
this.scheduleControl1.Calendar.SelectedDates.EndUpdate();
} |
this.scheduleControl1.Appearance.ShowCaption = true;
this.scheduleControl1.CaptionPanel.Visible = true; |