This is a migrated thread and some comments may be shown as answers.

Set category on codebehind

1 Answer 76 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 13 Jan 2014, 11:59 AM
Hello. Help me. I want to change appointment's category in codebehind. Can i set it only by name of category? Default brushes are gradient?

this code not change color
new Appointment(){Subject="April",Start =DateTime.Today,End =DateTime.Today.AddHours(4), Category = new Category(){CategoryName = "Red Category"}}
 

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 14 Jan 2014, 03:06 PM
Hi John,

In order to add a Category to an Appointment you should not create a new Category but add an already existing one. You can find the Categories collection in the CategoriesSource property of the ScheduleView:

var appointment = new Appointment();
appointment.Category = this.scheduleView.CategoriesSource.Cast<Category>().FirstOrDefault(c => c.CategoryName == "Green Category");

Hope this helps. If you have any other questions let us know.

Regards,
Kalin
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
ScheduleView
Asked by
John
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or