//Update days method is used to alter the Date collection as per selection change in Month column(if Feb is Selected day collection has value from 1 to 28)

        public void UpdateDays(ObservableCollection <object> Date, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                if (Date.Count == 3)
                {
                    bool flag = false;
                    if (e.OldValue != null && e.NewValue != null && (e.OldValue as ObservableCollection <object>).Count == 3 && (e.NewValue as ObservableCollection <object>).Count == 3)
                    {
                        if (!object.Equals((e.OldValue as IList)[0], (e.NewValue as IList)[0]))
                        {
                            flag = true;
                        }
                        if (!object.Equals((e.OldValue as IList)[2], (e.NewValue as IList)[2]))
                        {
                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        ObservableCollection <object> days = new ObservableCollection <object>();
                        int month = DateTime.ParseExact(Months[(e.NewValue as IList)[0].ToString()], "MMMM", CultureInfo.InvariantCulture).Month;
                        int year  = int.Parse((e.NewValue as IList)[2].ToString());
                        for (int j = 1; j <= DateTime.DaysInMonth(year, month); j++)
                        {
                            if (j < 10)
                            {
                                days.Add("0" + j);
                            }
                            else
                            {
                                days.Add(j.ToString());
                            }
                        }
                        ObservableCollection <object> PreviousValue = new ObservableCollection <object>();

                        foreach (var item in e.NewValue as IList)
                        {
                            PreviousValue.Add(item);
                        }
                        if (days.Count > 0)
                        {
                            Date.RemoveAt(1);
                            Date.Insert(1, days);
                        }

                        if ((Date[1] as IList).Contains(PreviousValue[1]))
                        {
                            this.SelectedItem = PreviousValue;
                        }
                        else
                        {
                            PreviousValue[1]  = (Date[1] as IList)[(Date[1] as IList).Count - 1];
                            this.SelectedItem = PreviousValue;
                        }
                    }
                }
            });
        }
 private void picker_SelectionChanged(object sender, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
 {
     if (picker.ItemsSource != null && e.NewValue is IList && (e.NewValue as IList).Count > 0 && CurrentItem != (e.NewValue as IList)[0].ToString())
     {
         //Updated the second column collection based on first column selected value.
         (picker.ItemsSource as ObservableCollection <object>).RemoveAt(1);
         (picker.ItemsSource as ObservableCollection <object>).Add(GetCountry((e.NewValue as IList)[0].ToString()));
     }
 }
Esempio n. 3
0
        private void picker_SelectionChanged(object sender, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
        {
            var newValue = e.NewValue as IList;

            if (newValue != null && newValue.Count == 3)
            {
                ((SfPicker)sender).HeaderText = $"{newValue[0]} {newValue[1]} {newValue[2]}";
                (this.BindingContext as OrdonnanceCotationViewModel).Selected = newValue;
            }
        }
Esempio n. 4
0
 private void popuppicker_CancelButtonClicked(object sender, SelectionChangedEventArgs e)
 {
     if (popupendpicker.IsOpen)
     {
         (this.BindingContext as DateTimePickerViewModel).SelectedEndTime = GetCollectionfromstring(enddate.Text);
     }
     else
     {
         (this.BindingContext as DateTimePickerViewModel).SelectedStartTime = GetCollectionfromstring(startdate.Text);
     }
 }
Esempio n. 5
0
 void Picker_SelectionChanged(object sender, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
 {
     if (e.NewValue != null)
     {
         Label lbl = new Label();
         lbl.Text = e.NewValue.ToString() + " " + "has been selected";
         eventLogLayout.Children.Insert(0, lbl);
         color = PickerHelper.GetColor(e.NewValue);
         if (Device.RuntimePlatform == Device.UWP)
         {
             picker.SelectionBackgroundColor = color;
         }
         else
         {
             picker.BackgroundColor = Color.FromRgba(color.R, color.G, color.B, 0.2);
         }
     }
 }
Esempio n. 6
0
 private void popuppicker_OkButtonClicked(object sender, SelectionChangedEventArgs e)
 {
     if (popupendpicker.IsOpen)
     {
         if ((e.NewValue as ObservableCollection <object>).Count != 0)
         {
             (this.BindingContext as DateTimePickerViewModel).SelectedEndTime = GetCollectionfromList(e.NewValue as IList);
         }
         enddate.Text = GetStringfromCollection((this.BindingContext as DateTimePickerViewModel).SelectedEndTime);
     }
     else
     {
         if ((e.NewValue as ObservableCollection <object>).Count != 0)
         {
             (this.BindingContext as DateTimePickerViewModel).SelectedStartTime = GetCollectionfromList(e.NewValue as IList);
             startdate.Text = GetStringfromCollection((this.BindingContext as DateTimePickerViewModel).SelectedStartTime);
         }
     }
 }
Esempio n. 7
0
 private void CustomDatePicker_SelectionChanged(object sender, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
 {
     UpdateDays(Date, e);
 }
 private void CustomDateTimePicker_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     UpdateDays(Date, e);
 }
        public void UpdateDays(ObservableCollection <object> Date, SelectionChangedEventArgs e)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                try
                {
                    if (Date.Count == 5)
                    {
                        bool isupdate = false;
                        if (e.OldValue != null && e.NewValue != null)
                        {
                            if (!object.Equals((e.OldValue as IList)[1], (e.NewValue as IList)[1]))
                            {
                                isupdate = true;
                            }

                            if (!object.Equals((e.OldValue as IList)[0], (e.NewValue as IList)[0]))
                            {
                                isupdate = true;
                            }
                        }

                        if (isupdate)
                        {
                            ObservableCollection <object> days = new ObservableCollection <object>();
                            int month = DateTime.ParseExact(months[(e.NewValue as IList)[1].ToString()], "MMMM", CultureInfo.InvariantCulture).Month;
                            int year  = int.Parse((e.NewValue as IList)[0].ToString());
                            for (int j = 1; j <= DateTime.DaysInMonth(year, month); j++)
                            {
                                if (j < 10)
                                {
                                    days.Add("0" + j);
                                }
                                else
                                {
                                    days.Add(j.ToString());
                                }
                            }

                            ObservableCollection <object> oldvalue = new ObservableCollection <object>();

                            foreach (var item in e.NewValue as IList)
                            {
                                oldvalue.Add(item);
                            }

                            if (days.Count > 0)
                            {
                                Date.RemoveAt(2);
                                Date.Insert(2, days);
                            }

                            if ((Date[2] as IList).Contains(oldvalue[2]))
                            {
                                this.SelectedItem = oldvalue;
                            }
                            else
                            {
                                oldvalue[2]       = (Date[2] as IList)[(Date[2] as IList).Count - 1];
                                this.SelectedItem = oldvalue;
                            }
                        }
                    }
                }
                catch
                {
                }
            });
        }
Esempio n. 10
0
        public void UpdateDays(ObservableCollection <object> date, Syncfusion.SfPicker.XForms.SelectionChangedEventArgs e)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                if (date.Count == 3)
                {
                    var flag = false;
                    if (e.OldValue != null && e.NewValue != null && ((ObservableCollection <object>)e.OldValue).Count == 3 && ((ObservableCollection <object>)e.NewValue).Count == 3)
                    {
                        if (!Equals(((IList)e.OldValue)[0], ((IList)e.NewValue)[0]))
                        {
                            flag = true;
                        }
                        if (!Equals(((IList)e.OldValue)[2], ((IList)e.NewValue)[2]))
                        {
                            flag = true;
                        }
                    }

                    if (flag)
                    {
                        var days  = new ObservableCollection <object>();
                        var month = DateTime.ParseExact(Months[((IList)e.NewValue)[0].ToString()], "MMMM", CultureInfo.InvariantCulture).Month;
                        var year  = int.Parse(((IList)e.NewValue)[2].ToString());

                        for (var j = 1; j <= DateTime.DaysInMonth(year, month); j++)
                        {
                            if (j < 10)
                            {
                                days.Add("0" + j);
                            }
                            else
                            {
                                days.Add(j.ToString());
                            }
                        }

                        var previousValue = new ObservableCollection <object>();

                        foreach (var item in (IList)e.NewValue)
                        {
                            previousValue.Add(item);
                        }

                        if (days.Count > 0)
                        {
                            date.RemoveAt(1);
                            date.Insert(1, days);
                        }

                        if (((IList)date[1]).Contains(previousValue[1]))
                        {
                            SelectedItem = previousValue;
                        }
                        else
                        {
                            previousValue[1] = ((IList)date[1])[((IList)date[1]).Count - 1];
                            SelectedItem     = previousValue;
                        }
                    }
                }
            });
        }