public MainPage()
        {
            InitializeComponent();
            this.progressbar = new SfCircularProgressBar();
            this.border      = new SfBorder();


            this.border.BorderColor     = Color.LightGray;
            this.border.BackgroundColor = Color.White;
            this.border.CornerRadius    = 35;
            this.border.Content         = this.progressbar;
            this.border.BorderWidth     = 0.2;

            this.progressbar.SegmentCount                   = 10;
            this.progressbar.IndicatorInnerRadius           = 0.5;
            this.progressbar.IndicatorOuterRadius           = 0.7;
            this.progressbar.ShowProgressValue              = true;
            this.progressbar.GapWidth                       = 0.5;
            this.progressbar.WidthRequest                   = 70;
            this.progressbar.HeightRequest                  = 55;
            this.progressbar.IndeterminateAnimationDuration = 750;

            var pullingTemplate = new DataTemplate(() =>
            {
                return(new ViewCell {
                    View = this.border
                });
            });

            this.pullToRefresh.Refreshing += this.PullToRefresh_Refreshing;
            this.pullToRefresh.Pulling    += this.PullToRefresh_Pulling;

            this.pullToRefresh.PullingViewTemplate    = pullingTemplate;
            this.pullToRefresh.RefreshingViewTemplate = pullingTemplate;
        }
예제 #2
0
        //End of GroupHeader Templates

        //List ItemTemplate

        private DataTemplate SetListViewItemTemplate()
        {
            listView.CollapseAll();
            DataTemplate t = new DataTemplate(() => {
                SfBorder Border = new SfBorder()
                {
                    CornerRadius = new Thickness(0, 0, 10, 10), BorderWidth = 0, VerticalOptions = LayoutOptions.FillAndExpand
                };

                var grid = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.StartAndExpand, Spacing = 0
                };
                grid.BackgroundColor = Xamarin.Forms.Color.FromRgba(0, 0, 0, 0.35);


                var HolderInside = new Grid()
                {
                    VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.Start, Margin = 10, Padding = 10
                };
                HolderInside.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Auto)
                });
                HolderInside.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(1, GridUnitType.Star)
                });

                SfChart chart = PrefChart(Xamarin.Essentials.Preferences.Get("chartType", 0));
                HolderInside.Children.Add(chart);
                Grid.SetRow(chart, 0);

                grid.Children.Add(HolderInside);

                StackLayout labelHolder = new StackLayout();
                Label l = new Label()
                {
                    FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.End, FontSize = 13, TextColor = Color.White, Margin = new Thickness(5, 0, 0, 0)
                };
                l.SetBinding(Label.TextProperty, new Binding("TeachersName"));
                Label l2 = new Label()
                {
                    FontAttributes = FontAttributes.Italic, VerticalOptions = LayoutOptions.Center, FontSize = 12, TextColor = Color.White, Margin = new Thickness(5, 0, 0, 2)
                };
                Binding periodB      = new Binding("TeachersEmail");
                periodB.StringFormat = "Email: {0}";
                l2.SetBinding(Label.TextProperty, periodB);
                labelHolder.Orientation = StackOrientation.Vertical;
                labelHolder.Children.Add(l);
                labelHolder.Children.Add(l2);

                grid.Children.Add(labelHolder);

                Border.Content = grid;
                return(Border);
            });

            return(t);
        }
예제 #3
0
        /// <summary>
        /// You can override this method to subscribe to AssociatedObject events and initialize properties.
        /// </summary>
        /// <param name="bindAble">SampleView type parameter named as bindAble</param>
        protected override void OnAttachedTo(SampleView bindAble)
        {
            this.viewModel   = new DataGridPullToRefreshViewModel();
            this.progressbar = new SfCircularProgressBar();
            this.border      = new SfBorder();

            this.border.BorderColor     = Color.LightGray;
            this.border.BackgroundColor = Color.White;
            this.border.CornerRadius    = 35;
            this.border.Content         = this.progressbar;
            this.border.BorderWidth     = 0.2;

            this.progressbar.SegmentCount                   = 10;
            this.progressbar.IndicatorInnerRadius           = 0.5;
            this.progressbar.IndicatorOuterRadius           = 0.7;
            this.progressbar.ShowProgressValue              = true;
            this.progressbar.GapWidth                       = 0.5;
            this.progressbar.WidthRequest                   = 70;
            this.progressbar.HeightRequest                  = 55;
            this.progressbar.IndeterminateAnimationDuration = 750;

            bindAble.BindingContext   = this.viewModel;
            this.pullToRefresh        = bindAble.FindByName <SfPullToRefresh>("pullToRefresh");
            this.dataGrid             = bindAble.FindByName <SfDataGrid>("dataGrid");
            this.transitionType       = bindAble.FindByName <PickerExt>("transitionType");
            this.dataGrid.ItemsSource = this.viewModel.OrdersInfo;
            this.transitionType.Items.Add("SlideOnTop");
            this.transitionType.Items.Add("Push");
            this.transitionType.SelectedIndex         = 0;
            this.transitionType.SelectedIndexChanged += this.OnSelectionChanged;
            this.pullToRefresh.Refreshing            += this.PullToRefresh_Refreshing;
            this.pullToRefresh.Pulling += this.PullToRefresh_Pulling;

            var pullingTemplate = new DataTemplate(() =>
            {
                return(new ViewCell {
                    View = this.border
                });
            });

            this.pullToRefresh.PullingViewTemplate    = pullingTemplate;
            this.pullToRefresh.RefreshingViewTemplate = pullingTemplate;

            base.OnAttachedTo(bindAble);
        }
예제 #4
0
        public SettingsView()
        {
            this.InitializeComponent();
            this.BindingContext = AppSettings.Instance;

            var colors = new List <Color>
            {
                Color.FromHex("#f54e5e"),
                Color.FromHex("#2f72e4"),
                Color.FromHex("#5d4cf7"),
                Color.FromHex("#06846a"),
                Color.FromHex("#d54008"),
            };

            var viewCollection = new ObservableCollection <View>();

            foreach (var color in colors)
            {
                var grid   = new Grid();
                var border = new SfBorder
                {
                    Margin            = new Thickness(4),
                    HorizontalOptions = LayoutOptions.Center,
                    CornerRadius      = 22,
                    BorderColor       = color,
                    Content           = new BoxView {
                        Color = color
                    },
                };
                grid.Children.Add(border);
                viewCollection.Add(grid);
            }

            this.PrimaryColorsView.ItemsSource = viewCollection;
            this.UpdatePrimaryColorIndex();
            this.UpdatePrimaryColor();
            this.PrimaryColorsView.SelectionChanged += (sender, e) =>
            {
                this.PrimaryColorsView.SelectionIndicatorSettings.Color = colors[e.Index];
                AppSettings.Instance.SelectedPrimaryColor = this.PrimaryColorsView.SelectedIndex;
            };
        }
예제 #5
0
        public ChatEntryRenderer()
        {
            UIKeyboard.Notifications.ObserveWillShow((sender, args) =>
            {
                if (Element != null)
                {
                    if (Element.AutomationId == "ChatMessageEntry")
                    {
                        Grid st      = (Grid)Element.Parent;
                        SfBorder st1 = (SfBorder)st.Parent;

                        Grid st2 = (Grid)st1.Parent;

                        st2.Margin = new Thickness(0, 0, 0, args.FrameEnd.Height - 5); //push the entry up to keyboard height when keyboard is activated
                    }
                }
            });

            UIKeyboard.Notifications.ObserveWillHide((sender, args) =>
            {
                if (Element != null)
                {
                    if (Element.AutomationId == "ChatMessageEntry")
                    {
                        Grid st      = (Grid)Element.Parent;
                        SfBorder st1 = (SfBorder)st.Parent;
                        st1.Padding  = new Thickness(5, 0, 0, 0);
                        Grid st2     = (Grid)st1.Parent;

                        st2.Margin = new Thickness(0); //set the margins to zero when keyboard is dismissed
                    }

                    //Grid st = (Grid)Element.Parent;
                    //SfBorder st1 = (SfBorder)st.Parent;
                    //Grid st2 = (Grid)st1.Parent;
                    //st2.Margin = new Thickness(0); //set the margins to zero when keyboard is dismissed
                }
            });
        }
예제 #6
0
        // Group header Template
        private DataTemplate DefGroupHeaderTemplate()
        {
            DataTemplate t = new DataTemplate(() =>
            {
                SfBorder HeaderBorder = new SfBorder()
                {
                    CornerRadius = new Thickness(10, 10, 10, 0), BorderWidth = 0
                };
                var MainGrid = new Grid()
                {
                    VerticalOptions = LayoutOptions.Center, HeightRequest = 58, HorizontalOptions = LayoutOptions.FillAndExpand, Margin = new Thickness(0, 10, 0, 0), Padding = 0, RowSpacing = 0, ColumnSpacing = 0
                };

                MainGrid.BackgroundColor = Xamarin.Forms.Color.FromRgba(0, 0, 0, 0.70);

                MainGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                MainGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });
                MainGrid.ColumnDefinitions.Add(new ColumnDefinition()
                {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                Binding binding1            = new Binding("Key");
                binding1.Converter          = new GroupHeaderConverter();
                binding1.ConverterParameter = 0;

                var label = new Label()
                {
                    VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start, FontSize = 17, FontAttributes = FontAttributes.Bold, TextColor = Color.White, Margin = new Thickness(5, 0, 0, 0)
                };
                label.SetBinding(Label.TextProperty, binding1);

                Binding binding4            = new Binding("Key");
                binding4.Converter          = new GroupHeaderConverter();
                binding4.ConverterParameter = 3;
                var classType = new Label()
                {
                    VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, FontSize = 10, TextColor = Color.White
                };
                classType.SetBinding(Label.TextProperty, binding4);

                var stackLayout         = new StackLayout();
                stackLayout.Orientation = StackOrientation.Horizontal;
                stackLayout.Children.Add(label);
                stackLayout.Children.Add(classType);

                Binding binding2            = new Binding("Key");
                binding2.Converter          = new GroupHeaderConverter();
                binding2.ConverterParameter = 1;
                binding2.StringFormat       = "{0}%";

                Frame border = new Frame()
                {
                    Padding = 0, WidthRequest = 75, HeightRequest = 50, Margin = 10, VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.End
                };
                StackLayout score = new StackLayout()
                {
                    VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Center
                };
                Label scoreLabel = new Label()
                {
                    TextColor = Color.White, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, VerticalTextAlignment = TextAlignment.Center
                };
                scoreLabel.SetBinding(Label.TextProperty, binding2);
                score.Children.Add(scoreLabel);
                Binding binding3            = new Binding("Key");
                binding3.Converter          = new GroupHeaderConverter();
                binding3.ConverterParameter = 2;
                border.SetBinding(BackgroundColorProperty, binding3);
                border.Content = score;

                MainGrid.Children.Add(stackLayout);
                Grid.SetColumn(stackLayout, 0);
                Grid.SetColumnSpan(stackLayout, 2);

                MainGrid.Children.Add(border);
                Grid.SetColumn(border, 2);

                HeaderBorder.Content = MainGrid;

                return(HeaderBorder);
            });

            return(t);
        }
        private SfPopupLayout CreateSearchPopoutLayout()
        {
            var popup = new SfPopupLayout
            {
                PopupView =
                {
                    ShowHeader    = false,
                    ShowFooter    = false,
                    AnimationMode = AnimationMode.Zoom
                }
            };

            var stack = new StackLayout();

            var searchBar = new SearchBar();

            searchBar.SetBinding(SearchBar.TextProperty, "AddressText");
            searchBar.TextChanged += OnSearchBarTextChanged;

            var topStack = new StackLayout
            {
                IsVisible         = false,
                Orientation       = StackOrientation.Horizontal,
                Spacing           = 0.0,
                HorizontalOptions = LayoutOptions.EndAndExpand
            };

            var backButton = new SfButton();

            backButton.Clicked += (sender, args) =>
            {
                popup.IsOpen    = false;
                popup.IsVisible = false;
            };
            Application.Current.Resources.TryGetValue("Back", out var resource);
            // backButton.Text = (string) resource;
            // backButton.Style = (Style) Resources["NavigationBarButtonStyle"];

            topStack.Children.Add(backButton);

            var searchBorder = new SfBorder();

            var borderlessEntry = new BorderlessEntry();

            borderlessEntry.SetBinding(Entry.TextProperty, "AddressText");
            borderlessEntry.Placeholder       = "Search here";
            borderlessEntry.HorizontalOptions = LayoutOptions.FillAndExpand;
            // borderlessEntry.Style = (Style) Resources["SearchEntryStyle"];

            //  searchBorder.Children.Append(borderlessEntry);

            topStack.Children.Add(borderlessEntry);

            var sfListView = new SfListView
            {
                ItemsSource = viewModel.Addresses,
                Margin      = new Thickness(8, 4),
                TapCommand  = viewModel.SearchLocationTapped
            };
            // SfListView.SetBinding(SfListView.ItemsSourceProperty, "Addresses");


            var listViewDataTemplate = new DataTemplate(() =>
            {
                var grid = new Grid();

                var addressForm = new Label
                {
                    FontAttributes  = FontAttributes.None,
                    BackgroundColor = Color.White,
                    FontSize        = 12
                };
                ;
                addressForm.SetBinding(Label.TextProperty, new Binding("FreeformAddress"));
                grid.Children.Add(addressForm);

                return(grid);
            });

            sfListView.ItemTemplate = listViewDataTemplate;

            stack.Children.Add(searchBar);
            stack.Children.Add(sfListView);

            popup.PopupView.ContentTemplate = new DataTemplate(() => stack);

            return(popup);
        }