I have a scheduler control. The appointment and statuses are mapped with a SQL database. I would like to know how I have to store the brushes for each status.
According to https://supportcenter.devexpress.com/ticket/details/t1110967/appointment-status-brush-mapping-for-brushtype-brush this is possible. Only I can't figure out how. For the coloring of the status it's quite simple, but I would like to have a brush for each status.
I figured it out with the following code. I made a table with the following columns:
I created a dataset and populated the above columns into the dataset. After that I declared the fore- and backcolor for the brushes as Color. For the simplicity I only used a HatchBrush for this example, so I didn't need the Brushtype from the dataset.
Than I iterated trough each row of the dataset with the appointment statusses and set the right brush for each status.
Dim ForeColor as Color
Dim BackColor as Color
Dim statuses = New BindingList(Of StatusClass)
Dim appointmentStatus = New StatusClass()
For each row as DataRow in DataSetAppointmentStatus.AppointmentStatus
ForeColor = Color.FromName(row("ForeColor").ToString())
BackColor = Color.FromName(row("BackColor").ToString())
appointmentStatus.StatusId = CInt(row("statusId").ToString())
appointmentStatus.Brush = New HatchBrush(HatchStyle.WideUpwardDiagonal, ForeColor, BackColor)'.Red
appointmentStatus.DisplayName = row("StatusDescription").ToString()
appointmentStatus.MenuCaption = row("StatusDescription").ToString()
statuses.Add(appointmentStatus)
SchedulerDataStorage1.Statuses.Mappings.Id = "StatusId"
SchedulerDataStorage1.Statuses.Mappings.Brush = "Brush"
SchedulerDataStorage1.Statuses.Mappings.DisplayName = "DisplayName"
SchedulerDataStorage1.Statuses.Mappings.MenuCaption = "MenuCaption"
SchedulerDataStorage1.Statuses.DataSource = statuses
Next