For example on this demo:
http://demos.telerik.com/silverlight/#ScheduleView/CustomStyles/CustomTooltip
There is no application of AppointmentStyleSelector, however an appointment on the calendar pics up the color definition from the Categories choice and paints the background accordingly.
If this is a default behavior, any idea why I'm not experiencing it with the below code?
<
telerik:RadScheduleView
x:Name
=
"scheduleView"
Grid.Row
=
"1"
Grid.ColumnSpan
=
"2"
AppointmentsSource
=
"{Binding Appointments}"
ResourceTypesSource
=
"{Binding ResourceTypes}"
TimeMarkersSource
=
"{Binding TimeMarkers}"
VisibleRangeChangedCommand
=
"{Binding VisibleRangeChanged}"
VisibleRangeChangedCommandParameter
=
"{Binding VisibleRange, RelativeSource={RelativeSource Self}}"
ToolTipTemplate
=
"{StaticResource AppointmentToolTipTemplate}"
>
<
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:DayViewDefinition
/>
<
telerik:WeekViewDefinition
/>
<
telerik:MonthViewDefinition
/>
<
telerik:TimelineViewDefinition
/>
</
telerik:RadScheduleView.ViewDefinitions
>
<
telerik:RadScheduleView.GroupDescriptionsSource
>
<
telerik:GroupDescriptionCollection
>
<
telerik:DateGroupDescription
/>
<
telerik:ResourceGroupDescription
ResourceType
=
"Program"
/>
</
telerik:GroupDescriptionCollection
>
</
telerik:RadScheduleView.GroupDescriptionsSource
>
</
telerik:RadScheduleView
>
Many thanks,
Mark
9 Answers, 1 is accepted
Yes, the categorization is a build-in feature. Could you please try with the latest available assemblies - either with the beta release or the internal build from Monday and let us know if you still experience the issue.
If so, could you please send us a sample project in order to debug it here locally and track down the source of the problem.
Greetings,
Konstantina
the Telerik team
I still am having difficulties even with the latest build. I am trying to deploy it within an SL4 / JetPack themed biz app and am wondering if that theme is the culprit.
I do have the Schedule View wrapped in your Expression.Dark theme.
If you'll create a default SL app with those components it should exhibit the problem.
Attached I am sending you a short video in which you can see that I have created also a project using the JetPack theme and put a ScheduleView in it, but the appointments are colored according to the assigned categories.
Please let me know if I am doing something wrong.
Best wishes,
Konstantina
the Telerik team
I'm sure the mistakes are on my end ... I'll try and see if I can provide additional details or a project that recreates my difficulties.
Thank you for taking the time to test.
Kind regards,
Mark
As there is little documentation (if any) in respect to ScheduleView and Entity Framework, I have used as a reference for my implementation the following thread:
http://www.telerik.com/community/forums/silverlight/scheduleview/database-table-structure.aspx
With the sample provided I have been unable to get the appointment background to function. As this has been the "template" I've used for my project as it is also EF, it is understandable that the difficulty continues within my code.
Here is a link to the original which shows the issue at hand:
http://tinyurl.com/3mo28nv
Many thanks,
Mark
Thank you for the project.
To make it work you will have to do the following:
- First, rename the CategoryBrush field in the DB to CategoryBrushName, so that you can implemenent the Category class as illustrated in the attached file. In that way the color in the dialog will be present.
- Secondly, about the background of the appointments - you will have to create a Converter and a custom AppointmentTemplate and bind the background in the template to the CategoryBrush property of the Category class of the ScheduleView. You can fine more information how to create a custom AppointmentTemplate in this online demo.
Regards,
Konstantina
the Telerik team
Thank you for having a look at what was previously provided by Telerik as a demo. I'll work through what you have advised.
I must say, however, this is the first significant disappointment I have run into with your controls. In my view this control shouldn't require these additional steps in order to paint the background of what is otherwise a generic implementation.
That said, once again thank you for looking at this to date.
Kind regards,
Mark
Hi Konstantina
I update the Categories model (essentially) as you indicated, my version uses a color name converter as it is saved in the DB with a string name not a Hex value:
using System;
using System.Windows.Media;
using Telerik.Windows.Controls;
using System.Globalization;
using System.ComponentModel;
using System.Reflection;
namespace RoasterWerks.Web.Models
{
public partial class Category : ICategory
{
private Brush categoryBrush;
public Brush CategoryBrush
{
get
{
if (this.categoryBrush == null)
{
this.categoryBrush = this.GenerateColorFromString(this.CategoryBrushName);
}
return this.categoryBrush;
}
set
{
this.CategoryBrushName = (this.categoryBrush as SolidColorBrush).Color.ToString().Substring(1);
this.categoryBrush = value;
}
}
public bool Equals(ICategory other)
{
return this.DisplayName == other.DisplayName &&
this.CategoryBrush == other.CategoryBrush &&
this.CategoryName == other.CategoryName;
}
private SolidColorBrush GenerateColorFromString(string colorString)
{
Color cl = GetThisColor(colorString);
SolidColorBrush scb = new SolidColorBrush(cl);
return scb;
}
public Color GetThisColor(string colorString)
{
Type colorType = (typeof(System.Windows.Media.Colors));
if (colorType.GetProperty(colorString) != null)
{
object o = colorType.InvokeMember(colorString, BindingFlags.GetProperty, null, null, null); if (o != null)
{
return (Color)o;
}
}
return Colors.Black;
}
The data flows through the model fine and is saved in the Database without issue. Also the appointment modal does show all colors stored in the DB correctly.
The Categories class, however, remains null when I try to access it as a bound object. Additionally the message body is missing. There must be more that is missing within the example. I recognize that the provided sample is "just a start" but there is still no documentation or reasonably current video in respect to proper implementation with EF so I'm at a bit of a loss. Here is what is given in the Output window when I inspect the "value" object with generic binding:
{Test Subject : 7/6/2011 12:30:00 AM - 7/6/2011 1:00:00 AM}
base {System.Windows.DependencyObject}: {Test Subject : 7/6/2011 12:30:00 AM - 7/6/2011 1:00:00 AM}
Appointment: {SqlAppointment : 12}
Body: ""
Category: null
End: {7/6/2011 1:00:00 AM}
Importance: None
IsAllDayEvent: false
RecurrenceState: Master
Start: {7/6/2011 12:30:00 AM}
Subject: "Test Subject"
TimeMarker: null
Please let me know what else I can look at basis the sample.
Kind regards,
Mark