in

C1 Community

ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

RecurrencePattern problem + non-appointment field binding

Last post 06-11-2008 7:25 AM by C1_IrinaP. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 06-04-2008 4:51 AM

    RecurrencePattern problem + non-appointment field binding

    Hi,

    I have the following Calendar business object :

    public class Calendar
        {
            public int CalendarID { get; set; }
            public DateTime StartDateTime { get; set; }
            public DateTime EndDateTime { get; set; }
            public string Subject { get; set; }
            public string Description { get; set; }
            public string InternalDescription { get; set; }
            public string Location { get; set; }
            public string Pattern { get; set; }
        }

    I have also a CalendarViewModel that contains an ObservableCollection<Calendar> called CallendarCollection. I fill this collection with some data from a webservice and bind it to the scheduler:

    <Window.Resources>
            <viewModel:CalendarViewModel x:Key="_ds" />
        </Window.Resources>

    <c1sched:C1Scheduler x:Name="Scheduler1" EditAppointmentTemplate="{StaticResource myEditAppointmentTemplate}" Theme="{DynamicResource {ComponentResourceKey ResourceId=Dusk.Green, TypeInTargetAssembly={x:Type c1sched:C1Scheduler}}}" Style="{DynamicResource {ComponentResourceKey ResourceId=MonthStyle, TypeInTargetAssembly={x:Type c1sched:C1Scheduler}}}">

    <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.DataSource" Value="{Binding Source={StaticResource _ds}, Path=CallendarCollection, Mode=TwoWay}" />
                <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Body.MappingName" Value="Description"/>
                <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.End.MappingName" Value="EndDateTime"/>
                <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Start.MappingName" Value="StartDateTime"/>
                <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Subject.MappingName" Value="Subject"/>
                <c1sched:NestedPropertySetter PropertyName="DataStorage.AppointmentStorage.Mappings.Location.MappingName" Value="Location"/>

    </c1sched:C1Scheduler> 

    The recurrence pattern is a custom format like "FREQ=WEEKLY;BYDAY=3;" and other formats for other kinds of recurrences.

    Here are my questions:

    1.  How can I convert my custom recurrence pattern string to C1Scheduller RecurrencePattern class? I want some kind of binding between the scheduler appointmnet and my recurrence pattern string.

    2. I want to bind the InternalDescription to a control in the EditDialog of an appointment. Is this possible? Because my InternalDescription has no correspondence to a filed in the Appointment class. 

    Thank you kindly. 

  • 06-10-2008 12:36 PM In reply to

    Re: RecurrencePattern problem + non-appointment field binding

    > 1.  How can I convert my custom recurrence pattern string to C1Scheduller RecurrencePattern class? I want some kind of binding between the scheduler appointmnet and my recurrence pattern string.

    I don't think that binding between your custom recurrence pattern and C1Scheduller RecurrencePattern is possible. You should make convertion in your code. Can you tell, why do you need such property and how do you use it? 

    About your second question. C1Schedule control sets content of EditAppointmentTemplate to the copy of the currently edited Appointment object. Appointment.Tag property contains the source Appointment before editing. If you place your custom object into Appointment.Tag, in EditAppoitmentTemplate you can do something like that: 

         <TextBox x:Name="internalDescription" Text="{Binding Tag.Tag.InternalDescription, UpdateSourceTrigger=PropertyChanged}" />

    Please, before trying take the latest version of C1Schedule here:  http://prerelease.componentone.com/dotnet30/c1wpfschedule/2008-t2/C1WPFScheduler.3.0.20082.54.zip. The earlier builds have a bug with saving appointment tags at closing appointment window.

     

  • 06-10-2008 1:27 PM In reply to

    Re: RecurrencePattern problem + non-appointment field binding

    > Can you tell, why do you need such property and how do you use it?

     The appointment object from my project stores the recurrence pattern as a string. Example: "FREQ=WEEKLY;BYDAY=MO,TU;" means that the recurrence is Weekly and occurs on Monday and Tuesday. I don't have access to the database to add C1 specific AppointmentProperties so that C1 Scheduler can bind to it. So, I want to have some kind of converter between my custom recurrence pattern string and C1 Appointment RecurrencePattern class, because I want, of course, to use C1 recurrence features but I want to store the recurrence pattern in my own format [not in the format that gets serialized as Xml in AppointmentProperties]. So, maybe, in a future version I recommend to put another binding in AppointmentStorage for the RecurrencePattern and maybe a possibility to add a converter. If there's already this possibility, please correct me. I think this will make the recurrence part of the scheduler more flexible/adaptable to existing appointment database structures.

    Thank you.
     

  • 06-11-2008 7:25 AM In reply to

    Re: RecurrencePattern problem + non-appointment field binding

    Thank you for explanation.
Page 1 of 1 (4 items)
Contact ComponentOne: 1.800.858.2739 ©1987-2008 ComponentOne LLC All Rights Reserved.