Live Chat Icon For mobile
Live Chat Icon
Popular Categories.NET  (150).NET Core  (25)Angular  (45)ASP.NET  (48)ASP.NET Core  (59)ASP.NET MVC  (84)Azure  (28)Blazor  (79)DocIO  (18)Essential JS 2  (67)Essential Studio  (161)Flutter  (92)JavaScript  (143)Microsoft  (101)PDF  (55)React  (32)Succinctly series  (120)Syncfusion  (460)TypeScript  (30)Uno Platform  (2)UWP  (4)Vue  (26)Webinar  (20)Windows Forms  (54)WPF  (111)Xamarin  (122)XlsIO  (24)Other CategoriesBarcode  (4)BI  (29)Bold BI  (3)Build conference  (6)Business intelligence  (53)Button  (4)C#  (105)Chart  (46)Cloud  (9)Company  (445)Dashboard  (6)Data Science  (3)Data Validation  (3)DataGrid  (38)Development  (245)Doc  (7)DockingManager  (1)eBook  (91)Enterprise  (22)Entity Framework  (5)Essential Tools  (14)Excel  (18)Extensions  (12)File Manager  (3)Gantt  (8)Gauge  (6)Git  (3)Grid  (26)HTML  (9)Installer  (2)Knockout  (2)LINQPad  (1)Linux  (1)M-Commerce  (1)Metro Studio  (11)Mobile  (196)Mobile MVC  (9)OLAP server  (1)Open source  (1)Orubase  (12)Partners  (21)PDF viewer  (21)Performance  (4)PHP  (1)PivotGrid  (4)Predictive Analytics  (6)Report Server  (3)Reporting  (10)Reporting / Back Office  (11)Rich Text Editor  (5)Road Map  (9)Scheduler  (21)SfDataGrid  (8)Silverlight  (21)Sneak Peek  (15)Solution Services  (2)Spreadsheet  (6)SQL  (6)Stock Chart  (1)Surface  (4)Tablets  (5)Theme  (9)Tips and Tricks  (48)UI  (108)Uncategorized  (68)Unix  (2)User interface  (67)Visual State Manager  (1)Visual Studio  (18)Visual Studio Code  (10)Web  (175)What's new  (108)Windows 8  (19)Windows App  (1)Windows Phone  (15)Windows Phone 7  (9)WinRT  (26)
Share on twitter
Share on facebook
Share on linkedin
Easily Create a Meeting Room Calendar using Xamarin.Forms Scheduler

Easily Create a Meeting Room Calendar Using Xamarin.Forms Scheduler

In today’s business world, having a meeting room in the workplace is important. Apart from having it, you’ll have to share it efficiently and without causing conflict among teams, which can be more challenging. The meeting room calendar application allows everyone in your workplace to search for room availability in seconds, allowing for easy room booking among different teams with no time conflicts. Let’s walk through the steps to customize the look and feel of our Syncfusion Xamarin.Forms Scheduler component to design a meeting room calendar.

Designing a Meeting Room Calendar using Xamarin Scheduler
Meeting Room Calendar using Xamarin Scheduler

Multiple resources – overview

In our previous blog, Create a Scheduling App using Scheduler for Xamarin, we got a basic overview of Xamarin.Forms Scheduler and its usage in a real-time scenario. In this blog, I’ll continue with an overview of the multiple resources concept and how to utilize this feature in designing a meeting room calendar.

Designing a meeting room calendar

We are going to display only the Scheduler timeline view in this example. As you get started, there will be some restrictions already set for booking meeting rooms, like being unable to reserve a room if it is already booked during a non-accessible time range, such as lunch or during maintenance.

Also, you can’t edit the past meeting events. For example, you can’t book rooms on dates before the current date.

We have also added the Scheduler custom editor, which is used for appointment editing.

Getting started

Follows these steps to create a resource view Scheduler in your Xamarin.Forms application:

Step 1: Follow the getting started documentation to add a Xamarin.Forms SfSchedule control to your application.

Step 2: Then, make the following property changes in the instance of SfSchedule:

Refer to the following code example.

<syncfusion:SfSchedule x:Name="schedule" 
        ScheduleView = "TimelineView" 
        ShowResourceView="True" 
        ResourceViewMode="Absolute">
</syncfusion:SfSchedule >

Populating resources data

Let’s see how to customize the Scheduler layout to display the meeting rooms. The meeting rooms are defined as resources and each room will be displayed vertically against the common timescale.

Imagine that an office has five meeting rooms within its premises, and everyone should share those rooms. As soon as a person books a room, they own it for the entire booked time range and no other person can reserve the same room during that specific time.

To start with, let’s assume that the resource data holds some common room information such as room name, room ID, and a specific color to denote resource appointments. Apart from the default resource fields, you can also define other custom resource fields such as room capacity and its type by binding resources to any type of IEnumerable source. Specify the ResourceMapping attribute to map the properties in the underlying data source to the schedule resource.

Add the resources collections and bind it to the Xamarin Scheduler using the ScheduleResources property.

Refer to the following code example.

ObservableCollection<MeetingRoomInfo> MeetingRooms = new ObservableCollection<MeetingRoomInfo>();

MeetingRooms.Add(new MeetingRoomInfo() { Name = "Jammy", Id = "5001", Color = Color.FromHex("#FF339933"), Capacity = 15, RoomType = "Conference" });
MeetingRooms.Add(new MeetingRoomInfo() { Name = "Tweety", Id = "5002", Color = Color.FromHex("#FF00ABA9"), Capacity = 5, RoomType = "Cabin" });
MeetingRooms.Add(new MeetingRoomInfo() { Name = "Nestle", Id = "5003", Color = Color.FromHex("#FFE671B8"), Capacity = 6, RoomType = "Cabin" });
MeetingRooms.Add(new MeetingRoomInfo() { Name = "Phoneix", Id = "5004", Color = Color.FromHex("#FF1BA1E2"), Capacity = 20, RoomType = "Conference" });
MeetingRooms.Add(new MeetingRoomInfo() { Name = "Mission", Id = "5005", Color = Color.FromHex("#FFD80073"), Capacity = 10, RoomType = "Conference" });
MeetingRooms.Add(new MeetingRoomInfo() { Name = "Emilia", Id = "5006", Color = Color.FromHex("#FFA2C139"), Capacity = 12, RoomType = "Conference" });
<syncfusion:SfSchedule x:Name="schedule" 
        ScheduleView = "TimelineView" 
        ShowResourceView="True"
        ScheduleResources="{Binding MeetingRooms}" 
        ResourceViewMode="Absolute">
        <syncfusion:SfSchedule.ResourceMapping>
                <syncfusion:ResourceMapping 
                     Name="Name"
                     Id="Id"
                     Color="Color"/>
      </syncfusion:SfSchedule.ResourceMapping>
</syncfusion:SfSchedule >
Meeting Room Calendar Showing Resources
Meeting Room Calendar Showing Resources

Customizing the resource layout

You can customize the resource header through its template property and change its look using the ResourceItemTemplate property.

Refer to the following code example.

<ContentPage.Resources>
    <DataTemplate x:Key="CustomResourceTemplate">
        <StackLayout BackgroundColor="{Binding Color}">
        <Grid Margin="20,20,20,20">
            <Grid.RowDefinitions>
                <RowDefinition Height="0.3*"></RowDefinition>
                <RowDefinition Height="0.2*"></RowDefinition>
                <RowDefinition Height="0.2*"></RowDefinition>
            </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <ColumnDefinition Width="20"></ColumnDefinition>
                </Grid.ColumnDefinitions>
                <Label 
                    Grid.Row="2" Grid.Column="0"
                    x:Name="lbl_seats" Text="Seats" TextColor="White"
                    HorizontalOptions="EndAndExpand"
                    HorizontalTextAlignment="End" FontSize="Small">
                    <Label.FontSize>
                        <OnPlatform x:TypeArguments="x:Double">
                            <On Platform="iOS">7</On>
                            <On Platform="Android">7</On>
                            <On Platform="WPF">10</On>
                            <On Platform="UWP">10</On>
                        </OnPlatform>
                    </Label.FontSize>
                </Label>
            <Label Grid.Row="2" Grid.Column="1" x:Name="lbl_capacity"
                   Text="{Binding Capacity}"
                   BackgroundColor="LightGray"
                   TextColor="Black"
                   VerticalTextAlignment="Center" WidthRequest="5" HeightRequest="5"
                   HorizontalTextAlignment="Center">
                <Label.FontSize>
                    <OnPlatform x:TypeArguments="x:Double">
                        <On Platform="iOS">11</On>
                        <On Platform="Android">11</On>
                        <On Platform="WPF">11</On>
                        <On Platform="UWP">11</On>
                    </OnPlatform>
                </Label.FontSize>
            </Label>
                <Label x:Name="lbl_roomname" Text="{Binding Name}" TextColor="White"
                   Grid.Row="0" Grid.ColumnSpan="2" HorizontalTextAlignment="Start" 
                       FontSize="Small" FontAttributes="Bold">
                <Label.FontSize>
                    <OnPlatform x:TypeArguments="x:Double">
                        <On Platform="iOS">14</On>
                        <On Platform="Android">14</On>
                        <On Platform="WPF">14</On>
                        <On Platform="UWP">14</On>
                    </OnPlatform>
                </Label.FontSize>
            </Label>
                <Label x:Name="lbl_roomtype" Text="{Binding RoomType}" TextColor="White"
                   Grid.Row="1" Grid.ColumnSpan="2" HorizontalTextAlignment="Start" FontSize="Small">
                <Label.FontSize>
                    <OnPlatform x:TypeArguments="x:Double">
                        <On Platform="iOS">7</On>
                        <On Platform="Android">7</On>
                        <On Platform="WPF">10</On>
                        <On Platform="UWP">10</On>
                    </OnPlatform>
                </Label.FontSize>
            </Label>
        </Grid>
        </StackLayout>
    </DataTemplate>
</ContentPage.Resources>
<syncfusion:SfSchedule x:Name="schedule" 
        ScheduleView = "TimelineView" 
        ShowResourceView="True"
        ScheduleResources="{Binding MeetingRooms}" 
        ResourceItemTemplate="{StaticResource CustomResourceTemplate}"
        ResourceViewMode="Absolute"/>
Customizing the Meeting Room Calendar
Customizing the Meeting Room Calendar in Xamarin

Populating the meeting data

The header layout customization is over now, and it’s time to fill the Scheduler with room reservation data. Let’s form the data with meeting-related fields such as meeting summary, start time, end time, and location. Then, assign them to the Scheduler DataSource property. Each appointment in the Scheduler denotes a confirmed booking to convey the room reservation status at a specific time.

The Xamarin.Forms Scheduler supports full data binding to all types of IEnumerable sources. Specify the ScheduleAppointmentMapping attributes to map the properties in the underlying data source to the scheduler appointments.

Refer to the following code example.

<syncfusion:SfSchedule x:Name="schedule" 
        DataSource="{Binding Meetings}"                  
        ScheduleView = "TimelineView" 
        ShowResourceView="True"
        ScheduleResources="{Binding MeetingRooms}" 
        ResourceItemTemplate="{StaticResource CustomResourceTemplate}"
        ResourceViewMode="Absolute" >
<syncfusion:SfSchedule.AppointmentMapping>
    <syncfusion:ScheduleAppointmentMapping
            ColorMapping="Color"
            EndTimeMapping="To"
            StartTimeMapping="From"
            SubjectMapping="EventName"
            IsAllDayMapping="IsAllDay"
            RecurrenceRuleMapping="RecurrenceRule"     
            ResourceIdsMapping="ResourceIdCollection"/>
</syncfusion:SfSchedule.AppointmentMapping>
</ syncfusion:SfSchedule>

Blocking reservations on inaccessible cells

Now, we need to concentrate on another important action: making certain cells inaccessible to users. This can be done by adding the  SpecialTimeRegion in the SpecialTimeRegions property.

To prevent the appointment editor from opening inaccessible slots, set the CanEdit property of the TimeRegionSettings as false like in the following code.

<syncfusion:SfSchedule.SpecialTimeRegions>
    <syncfusion:TimeRegionSettings 
            StartHour="13" 
            EndHour="14" 
            Text="Lunch"
            CanEdit="False"
            Color="#EAEAEA"
            TextColor="Black"/>
</syncfusion:SfSchedule.SpecialTimeRegions>

To prevent appointment editor from opening on past dates in the schedule, set the MinDisplayDate to restrict date navigation features, namely Backward and MoveToDate.

<syncfusion:SfSchedule 
        x:Name="schedule" 
        DataSource="{Binding Meetings}"                  
        ScheduleView = "TimelineView" 
        MinDisplayDate="{Binding MinimumDate}” />

Resource

For more information, you can download the complete example for Designing a Meeting Room Calendar using Xamarin.Forms Scheduler.

Summary

To summarize, we have seen how to customize our Syncfusion Xamarin.Forms Scheduler to design a meeting room calendar by using additional styling options. Keep checking up with us, as more useful blogs are waiting in our queue that will show more of the customizing options available in the Scheduler.

If you are an existing Syncfusion user, please download the latest version from the License and Downloads page and try the new features for yourself. Also, our NuGet packages are available on NuGet.org.

If you aren’t a customer yet, you can try our 30-day free trial to check out these features. Also, try our other samples from this GitHub location.

Feel free to share your feedback or questions in the comments section below. You can also contact us through our support forumDirect-Trac, or feedback portal. We are always happy to assist you!

Related blogs

Tags:

Share this post:

Share on twitter
Share on facebook
Share on linkedin
Popular Now

Be the first to get updates

Subscribe RSS feed
Scroll To Top