Back to Devexpress

RecurrenceInfo.ToXml() Method

corelibraries-devexpress-dot-xtrascheduler-dot-recurrenceinfo-d69e895b.md

latest7.5 KB
Original Source

RecurrenceInfo.ToXml() Method

Creates an XML encoding of the recurrence information.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.Core.dll

NuGet Package : DevExpress.Scheduler.Core

Declaration

csharp
public string ToXml()
vb
Public Function ToXml As String

Returns

TypeDescription
String

A String value that represents an XML encoding of the recurrence information object.

|

Example

This example illustrates the use of the IRecurrenceInfo.ToXml method to obtain recurrence info in XML format.

csharp
scheduler.Storage.Appointments.Clear();
Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Pattern);
apt.Start = DateTime.Today.AddHours(3);
apt.End = apt.Start.AddHours(2);
apt.Subject = "TEST";

apt.RecurrenceInfo.Type = RecurrenceType.Weekly;
apt.RecurrenceInfo.Start = apt.Start;
apt.RecurrenceInfo.Periodicity = 2;
apt.RecurrenceInfo.WeekDays = WeekDays.Monday | WeekDays.Wednesday;
apt.RecurrenceInfo.Range = RecurrenceRange.OccurrenceCount;
apt.RecurrenceInfo.OccurrenceCount = 15;

string s = DevExpress.XtraScheduler.iCalendar.iCalendarHelper.ExtractRecurrenceRule(apt.RecurrenceInfo);
apt.Description = "RRULE:" + s + Environment.NewLine;
scheduler.Storage.Appointments.Add(apt);
apt.Description += apt.RecurrenceInfo.ToXml();
vb
scheduler.Storage.Appointments.Clear()
Dim apt As Appointment = scheduler.Storage.CreateAppointment(AppointmentType.Pattern)
apt.Start = Date.Today.AddHours(3)
apt.End = apt.Start.AddHours(2)
apt.Subject = "TEST"

apt.RecurrenceInfo.Type = RecurrenceType.Weekly
apt.RecurrenceInfo.Start = apt.Start
apt.RecurrenceInfo.Periodicity = 2
apt.RecurrenceInfo.WeekDays = WeekDays.Monday Or WeekDays.Wednesday
apt.RecurrenceInfo.Range = RecurrenceRange.OccurrenceCount
apt.RecurrenceInfo.OccurrenceCount = 15

Dim s As String = DevExpress.XtraScheduler.iCalendar.iCalendarHelper.ExtractRecurrenceRule(apt.RecurrenceInfo)
apt.Description = "RRULE:" & s & Environment.NewLine
scheduler.Storage.Appointments.Add(apt)
apt.Description += apt.RecurrenceInfo.ToXml()

The following code snippets (auto-collected from DevExpress Examples) contain references to the ToXml() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-scheduler-highlight-time-intervals/CS/SchedulerCellTemplate/MainWindow.xaml.cs#L56

csharp
info.Start = info.Start.Date.AddTicks(region.Start.TimeOfDay.Ticks);
    region.RecurrenceInfo = info.ToXml();
}

wpf-scheduler-generate-time-scales-from-view-model-collection/CS/WpfSchedulerTimelineScalesTemplate/TeamData.cs#L156

csharp
};
appt.RecurrenceInfo = new RecurrenceInfo() {
    AllDay = true,

wpf-scheduler-highlight-time-intervals/VB/SchedulerCellTemplate/MainWindow.xaml.vb#L72

vb
info.Start = info.Start.Date.AddTicks(region.Start.TimeOfDay.Ticks)
    region.RecurrenceInfo = info.ToXml()
End Sub

wpf-scheduler-generate-time-scales-from-view-model-collection/VB/WpfSchedulerTimelineScalesTemplate/TeamData.vb#L290

vb
Dim appt = New WpfSchedulerTimelineScalesTemplate.TeamAppointment() With {.AppointmentType = CInt(DevExpress.XtraScheduler.AppointmentType.Pattern), .AllDay = True, .Start = [date], .[End] = [date].AddDays(1), .Subject = String.Format("{0}'s Birthday", employee.FirstName), .Status = 0, .Label = 8, .CalendarId = 0}
appt.RecurrenceInfo = New DevExpress.XtraScheduler.RecurrenceInfo() With {.AllDay = True, .Start = [date], .Month = [date].Month, .DayNumber = [date].Day, .WeekOfMonth = DevExpress.XtraScheduler.WeekOfMonth.None, .Type = DevExpress.XtraScheduler.RecurrenceType.Yearly, .Range = DevExpress.XtraScheduler.RecurrenceRange.NoEndDate}.ToXml()
Return appt

wpf-scheduler-use-entity-framework-to-bind-to-data/VB/DXSample/Data/DataHelper.vb#L25

vb
Dim info As DevExpress.XtraScheduler.RecurrenceInfo = CType(DevExpress.Xpf.Scheduling.RecurrenceBuilder.Weekly(CDate((patternStart))).ByDay(CType((DevExpress.XtraScheduler.WeekDays.Monday Or DevExpress.XtraScheduler.WeekDays.Wednesday Or DevExpress.XtraScheduler.WeekDays.Friday), DevExpress.XtraScheduler.WeekDays)).Build(), DevExpress.XtraScheduler.RecurrenceInfo)
pattern.RecurrenceInfo = info.ToXml()
Dim weekStartDate As System.DateTime = DevExpress.XtraScheduler.Native.DateTimeHelper.GetStartOfWeekUI(CDate((DXSample.Data.DataHelper.Start.[Date])), CType((System.DayOfWeek.Monday), System.DayOfWeek)).[Date]

wpf-scheduler-filter-time-regions/VB/DXSample/Data/DataHelper.vb#L25

vb
Dim info As DevExpress.XtraScheduler.RecurrenceInfo = CType(DevExpress.Xpf.Scheduling.RecurrenceBuilder.Weekly(CDate((patternStart))).ByDay(CType((DevExpress.XtraScheduler.WeekDays.Monday Or DevExpress.XtraScheduler.WeekDays.Wednesday Or DevExpress.XtraScheduler.WeekDays.Friday), DevExpress.XtraScheduler.WeekDays)).Build(), DevExpress.XtraScheduler.RecurrenceInfo)
pattern.RecurrenceInfo = info.ToXml()
Dim weekStartDate As System.DateTime = DevExpress.XtraScheduler.Native.DateTimeHelper.GetStartOfWeekUI(CDate((DXSample.Data.DataHelper.Start.[Date])), CType((System.DayOfWeek.Monday), System.DayOfWeek)).[Date]

Implements

ToXml()

See Also

FromXml(String)

RecurrenceInfo Class

RecurrenceInfo Members

DevExpress.XtraScheduler Namespace