We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Workweekview ios + how to bind multiple days to the NoneWorkingDays property

Hey all,

I am currently using the syncfusion scheduler and it does seem to fit our needs. But on iOS it does display sat and sunday which it isn't supposed to do. I seem to have fixed this by just setting the NoneWorkingDays property, but I want to set both day "1" and day "6" (saturday and sunday).

This is the XAML I got right now that removes saturday. 

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:schedule="clr-namespace:Syncfusion.SfSchedule.XForms;assembly=Syncfusion.SfSchedule.XForms"
             x:Class="BNApp.Views.HomeScreenDetailWorkWeek" 
             Title="Business Navigator"  >
  <schedule:SfSchedule x:Name="Schedule"
                       ScheduleView="WorkWeekView"
                       Locale="nl-NL"
                       EnableNavigation="True"
                       BackgroundColor="White" FirstDayOfWeek="2" >
    <schedule:SfSchedule.WorkWeekViewSettings >
      <schedule:WorkWeekViewSettings NonWorkingsDays="6">      <---(help)
        <schedule:WorkWeekViewSettings.WorkWeekLabelSettings  >
          <schedule:WorkWeekLabelSettings TimeFormat="HH:mm" />
        </schedule:WorkWeekViewSettings.WorkWeekLabelSettings>
      </schedule:WorkWeekViewSettings>
    </schedule:SfSchedule.WorkWeekViewSettings>
  </schedule:SfSchedule>
</ContentPage>



This component does seem to work correctly on Android when displayed in WorkWeekview, but on iOS this workaround is needed.

6 Replies

LU Luuk September 27, 2016 10:28 AM UTC

UPDATE

To elaborate on the issue:

The issue is fixed when I don't set the TimeFormat of the WorkWeekView.. This seem to be a bug and really strange behavior. I do need the 24 hour notation, so I hope this bug will be adressed and fixed asap




LU Luuk September 27, 2016 10:29 AM UTC

<Grid x:Name="grid_layout">

    <schedule:SfSchedule
      x:Name="Schedule" ScheduleView="WorkWeekView"
      HorizontalOptions="FillAndExpand"
      VerticalOptions="FillAndExpand"
      Locale="nl-NL">


(This part breaks the schedule workview )
<!--<schedule:SfSchedule.WorkWeekViewSettings>
        <schedule:WorkWeekViewSettings >
          <schedule:WorkWeekViewSettings.WorkWeekLabelSettings>
            <schedule:WorkWeekLabelSettings TimeFormat="HH:mm"></schedule:WorkWeekLabelSettings>
          </schedule:WorkWeekViewSettings.WorkWeekLabelSettings>
        </schedule:WorkWeekViewSettings>
      </schedule:SfSchedule.WorkWeekViewSettings>-->

    </schedule:SfSchedule>


SG Swathi Gopal Syncfusion Team September 27, 2016 12:09 PM UTC

Hi Luuk, 
 
Thanks for your interest in Syncfusion products. 
 
We would like to let you know that we are able to reproduce the issue in the mentioned scenario and currently we are analyzing on your requirement, we will update you the details within two business days (Sep 29, 2016). We appreciate your patience until then.

 
As a workaround for the above mentioned issue you have used NonWorkingDays property of Schedule, where your requirement can be achieved by using the below code  
 
[c#] 
 
ObservableCollection<System.DayOfWeek> NonWorkingDays = new ObservableCollection<System.DayOfWeek>();      
 
            NonWorkingDays.Add(System.DayOfWeek.Saturday);
            NonWorkingDays.Add(System.DayOfWeek.Sunday);

            WorkWeekViewSettings workWeekViewSettings = new WorkWeekViewSettings();
            WorkWeekLabelSettings workWeekLabelSettings = new WorkWeekLabelSettings();
            workWeekLabelSettings.TimeFormat = "HH:mm";
            workWeekViewSettings.NonWorkingsDays = NonWorkingDays;
            workWeekViewSettings.WorkWeekLabelSettings = workWeekLabelSettings;
            Schedule.WorkWeekViewSettings = workWeekViewSettings;
                                 
  
 
Please let us know, if you have any concerns.  

Regards, 
Swathi G 



LU Luuk September 27, 2016 12:44 PM UTC

Hey,

Thank you for the quick reply, I am happy that it's indeed a bug and not something I did wrong.


I did find a workaround by writing in the code behind:

[c#] 

  if (Device.OS == TargetPlatform.iOS)
            {
                Schedule.WorkWeekViewSettings.NonWorkingsDays.Add(DayOfWeek.Saturday);
                Schedule.WorkWeekViewSettings.NonWorkingsDays.Add(DayOfWeek.Sunday);
            }



Also the following XAML seem to work:

[XAML]
<schedule:WorkWeekViewSettings.NonWorkingsDays>
        <x:DayOfWeek>
            <OnPlatform x:TypeArguments="x:DayOfWeek" iOS="Sunday">
            </OnPlatform>
           </x:DayOfWeek>
          <x:DayOfWeek>
            <OnPlatform x:TypeArguments="x:DayOfWeek" iOS="Saturday">
            </OnPlatform>
          </x:DayOfWeek>

</schedule:WorkWeekViewSettings.NonWorkingsDays>


The XAML above will be a workaround that only works for iOS, since Android somehow will remove both friday and thursday when applied... Even though I am using the Onplatform with only iOS.


LU Luuk September 27, 2016 12:46 PM UTC

Android in general does not seem to like using the enum names like friday etc. It does work when using the flags given to it for example monday = 1 so you write 1 instead of monday.


SP Subburaj Pandian Veluchamy Syncfusion Team September 29, 2016 10:38 AM UTC

Hi Luuk,

We are happy that provided workaround has resolved the mentioned issue. We have created a new support incident under your account to track the status of this issue. Please log on to our support website to check for further updates.

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know, if you have any query.

Regards,
Subburaj Pandian V.



Loader.
Live Chat Icon For mobile
Up arrow icon