I Have a problem I am using a custom appointment element to add a checkbox to the scheduler while that works the appointment is streching to the full time slot I can have multiple appointments in the same time slot so how do I stop this hapening.
Also I wish to place the name of the patient beside the time on the slot it self but no matter what I try it only shows the time slot
01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.Drawing;
04.
using
System.Linq;
05.
using
System.Text;
06.
using
System.Threading.Tasks;
07.
using
System.Windows.Forms;
08.
using
Telerik.WinControls.UI;
09.
10.
namespace
WindowsFormsApplication1.Classes.Appointments
11.
{
12.
public
class
MyAppointmentElement : AppointmentElement
13.
{
14.
public
MyAppointmentElement(RadScheduler scheduler, SchedulerView view, IEvent appointment)
15.
:
base
(scheduler, view, appointment)
16.
{ }
17.
18.
StackLayoutElement container =
new
StackLayoutElement();
19.
RadCheckBoxElement checkBox =
new
RadCheckBoxElement();
20.
StackLayoutElement panel =
new
StackLayoutElement();
21.
LightVisualElement timeInterval =
new
LightVisualElement();
22.
LightVisualElement description =
new
LightVisualElement();
23.
SourceContext SourceDal =
new
SourceContext();
24.
Patient patientInfo =
new
Patient();
25.
RadLabelElement label =
new
RadLabelElement();
26.
protected
override
void
CreateChildElements()
27.
{
28.
base
.CreateChildElements();
29.
30.
this
.container =
new
StackLayoutElement();
31.
this
.container.Orientation = Orientation.Horizontal;
32.
this
.container.StretchHorizontally =
true
;
33.
this
.container.StretchVertically =
true
;
34.
35.
this
.checkBox =
new
RadCheckBoxElement() { MaxSize =
new
Size(20, 0) };
36.
this
.checkBox.CheckStateChanged += CheckBox_CheckStateChanged;
37.
this
.container.Children.Add(
this
.checkBox);
38.
39.
40.
41.
this
.label =
new
RadLabelElement();
42.
this
.Text =
"David Buckley test "
;
43.
this
.container.Children.Add(
this
.label);
44.
45.
46.
this
.panel.StretchHorizontally =
true
;
47.
this
.panel.StretchVertically =
true
;
48.
this
.panel.Orientation = Orientation.Vertical;
49.
this
.panel.Children.Add(timeInterval);
50.
this
.panel.Children.Add(description);
51.
52.
53.
this
.container.Children.Add(
this
.panel);
54.
this
.Children.Add(
this
.container);
55.
}
56.
57.
protected
override
SizeF ArrangeOverride(SizeF finalSize)
58.
{
59.
SizeF size =
base
.ArrangeOverride(finalSize);
60.
61.
float
start =
this
.checkBox.DesiredSize.Width;
62.
this
.panel.Arrange(
new
RectangleF(start, 0, size.Width - start, size.Height));
63.
64.
return
size;
65.
}
66.
67.
private
void
CheckBox_CheckStateChanged(
object
sender, EventArgs e)
68.
{
69.
//...
70.
}
71.
72.
private
void
button_Click(
object
sender, EventArgs e)
73.
{
74.
this
.Scheduler.Appointments.Remove(
this
.Appointment);
75.
}
76.
77.
78.
79.
public
override
void
Synchronize()
80.
{
81.
base
.Synchronize();
82.
83.
timeInterval.Text =
this
.Appointment.Start.ToLongTimeString() +
" - "
+
this
.Appointment.End.ToLongTimeString();
84.
description.Text =
this
.Appointment.Summary;
85.
}
86.
87.
public
override
void
DrawEventText(Telerik.WinControls.Paint.IGraphics graphics)
88.
{
89.
//leave the method empty to prevent the default appointment information to be drawn
90.
}
91.
}
92.
}