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

Appointment Background - default behavior

9 Answers 147 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 23 Jun 2011, 07:42 PM
In reviewing the various ScheduleView examples, I understand that you can implement AppointmentStyleSelector for customization.  There seems to be, however, a default behavior which I'd like a bit of clarity on please.

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

Sort by
0
Konstantina
Telerik team
answered on 28 Jun 2011, 05:13 PM
Hello Mark,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 28 Jun 2011, 05:24 PM
Thank you Konstantina,

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.
0
Konstantina
Telerik team
answered on 01 Jul 2011, 02:58 PM
Hello Mark,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 01 Jul 2011, 02:59 PM
Hi Konstantina,

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
0
Mark
Top achievements
Rank 1
answered on 01 Jul 2011, 08:22 PM
Hi Konstantina,

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
0
Konstantina
Telerik team
answered on 06 Jul 2011, 03:30 PM
Hi 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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark
Top achievements
Rank 1
answered on 06 Jul 2011, 03:54 PM
Hi Konstantina

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
0
Mark
Top achievements
Rank 1
answered on 07 Jul 2011, 12:38 AM

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

0
Mark
Top achievements
Rank 1
answered on 07 Jul 2011, 01:54 AM
I'm all sorted - was improper binding at the end.
Tags
ScheduleView
Asked by
Mark
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Mark
Top achievements
Rank 1
Share this question
or