Exemplo n.º 1
0
        private StackLayout ObterFormLista()
        {
            StackLayout layoutPrincipal = ObterLayoutPrincipal();

            layoutPrincipal.WidthRequest = 350;

            StackLayout layoutOpcoes = new StackLayout();

            layoutOpcoes.Padding           = new Thickness(0, 0, 0, 0);
            layoutOpcoes.HorizontalOptions = LayoutOptions.CenterAndExpand;

            ListView listView = new ListView();

            listView.HeightRequest   = 200;
            listView.BackgroundColor = Color.FromHex("#FFFFFF");
            listView.SeparatorColor  = Color.FromHex("#B6B6B6");
            DataTemplate cell = new DataTemplate(() => {
                ViewCell vCell = new ViewCell();

                StackLayout layout       = new StackLayout();
                layout.HorizontalOptions = LayoutOptions.FillAndExpand;
                layout.VerticalOptions   = LayoutOptions.CenterAndExpand;
                layout.Orientation       = StackOrientation.Horizontal;

                CheckBoxView check = new CheckBoxView();
                check.SetBinding(CheckBoxView.IsCheckedProperty, new Binding("selecionado", BindingMode.TwoWay));
                layout.Children.Add(check);

                Label lblDescricao = new Label()
                {
                    TextColor = Color.FromHex("#212121"),
                    FontSize  = 17
                };

                lblDescricao.SetBinding(Label.TextProperty, new Binding("descricao", BindingMode.OneWay));
                layout.Children.Add(lblDescricao);

                vCell.View = layout;
                return(vCell);
            });

            listView.ItemTemplate = cell;

            listView.ItemsSource = Item.Opcoes;

            layoutOpcoes.Children.Add(listView);

            //layoutPrincipal.HeightRequest = 300;
            layoutPrincipal.Children.Add(layoutOpcoes);
            layoutPrincipal.Children.Add(ObterLayoutBotoes());

            return(layoutPrincipal);
        }
Exemplo n.º 2
0
        public void Initialize(int nivel, bool temFilhos)
        {
            Spacing = 0;

            StackLayout node = new StackLayout();

            node.Spacing = 0;

            if (temFilhos)
            {
                node.Padding = new Thickness(10 + (5 * nivel), 4, 0, 4);
            }
            else
            {
                node.Padding = new Thickness(30 + (10 * nivel), 4, 0, 4);
            }
            node.Orientation = StackOrientation.Horizontal;

            if (count % 2 == 0)
            {
                node.BackgroundColor = Color.FromHex("#DEDEDE");
            }
            else
            {
                node.BackgroundColor = Color.FromHex("#FFFFFF");
            }

            StackLayout layoutCheck = new StackLayout();

            layoutCheck.Padding = new Thickness(0, 0, 5, 0);
            Check = new CheckBoxView();
            Check.VerticalOptions = LayoutOptions.Center;
            Check.SetBinding(CheckBoxView.IsCheckedProperty, new Binding("Item.Pesquisa04.selecionado", BindingMode.TwoWay));
            Check.Checked += Check_Checked;
            layoutCheck.Children.Add(Check);

            StackLayout layoutImage = new StackLayout();

            Botao = new ImageButtonItemArvore()
            {
                Source = "minus.png"
            };

            Botao.SetBinding(ImageButtonItemArvore.CommandProperty, new Binding("CmdExpand", BindingMode.OneWay));

            layoutImage.Children.Add(Botao);

            StackLayout layoutLabel = new StackLayout();

            layoutLabel.HorizontalOptions = LayoutOptions.FillAndExpand;
            layoutLabel.Padding           = new Thickness(5, 2, 0, 0);

            if (temFilhos)
            {
                Label label = new Label()
                {
                    Text            = Pesquisa04.descricao,
                    FontSize        = 17,
                    VerticalOptions = LayoutOptions.Center,
                    TextColor       = Color.FromHex("#212121")
                };

                label.FontAttributes = FontAttributes.Bold;

                layoutLabel.Children.Add(label);
            }
            else
            {
                LabelItemArvoreFormulario label = new LabelItemArvoreFormulario(Pesquisa04);
                label.SetBinding(LabelItemArvoreFormulario.CommandProperty, new Binding("CmdShowDialogResposta", BindingMode.OneWay));
                label.BindingContext = this.BindingContext;
                layoutLabel.Children.Add(label);
            }

            Image imgFiltro = new Image();

            imgFiltro.Source        = "ic_filter_grey600_24dp.png";
            imgFiltro.WidthRequest  = 22;
            imgFiltro.HeightRequest = 22;
            //imgFiltro.Margin = new Thickness(0, 0, 10, 0);
            imgFiltro.SetBinding(Image.IsVisibleProperty, new Binding("TemFiltro", BindingMode.OneWay));

            node.Children.Add(layoutCheck);

            if (temFilhos)
            {
                node.Children.Add(layoutImage);
            }

            node.Children.Add(layoutLabel);

            if (!temFilhos)
            {
                node.Children.Add(imgFiltro);
            }

            IsExpanded = true;

            Children.Add(node);
        }
Exemplo n.º 3
0
        public void Initialize(int nivel, bool temFilhos)
        {
            Spacing = 0;

            StackLayout node = new StackLayout();

            node.Spacing = 0;

            if (temFilhos)
            {
                node.Padding = new Thickness(10 + (5 * nivel), 4, 0, 4);
            }
            else
            {
                node.Padding = new Thickness(30 + (10 * nivel), 4, 0, 4);
            }
            node.Orientation = StackOrientation.Horizontal;

            if (count % 2 == 0)
            {
                node.BackgroundColor = Color.FromHex("#DEDEDE");
            }
            else
            {
                node.BackgroundColor = Color.FromHex("#FFFFFF");
            }

            StackLayout layoutCheck = new StackLayout();

            layoutCheck.VerticalOptions = LayoutOptions.Center;
            layoutCheck.Padding         = new Thickness(0, 0, 5, 0);
            Check = new CheckBoxView();
            Check.VerticalOptions = LayoutOptions.Center;
            Check.IsChecked       = false;
            //Check.SetBinding(CheckBoxView.IsCheckedProperty, new Binding("Item.Obj.selecionado", BindingMode.TwoWay));
            Check.Tag = this;
            layoutCheck.Children.Add(Check);

            StackLayout layoutImage = new StackLayout();

            layoutImage.VerticalOptions = LayoutOptions.Center;
            Botao = new ImageButtonItemArvore()
            {
                Source          = "minus.png",
                VerticalOptions = LayoutOptions.Center
            };

            Botao.SetBinding(ImageButtonItemArvore.CommandProperty, new Binding("CmdExpand", BindingMode.OneWay));

            layoutImage.Children.Add(Botao);

            StackLayout layoutLabel = new StackLayout();

            layoutLabel.Padding         = new Thickness(5, 0, 0, 0);
            layoutLabel.VerticalOptions = LayoutOptions.Center;
            Label label = new Label()
            {
                FontSize        = 17,
                VerticalOptions = LayoutOptions.Center,
                TextColor       = Color.FromHex("#212121")
            };

            if (temFilhos)
            {
                label.FontAttributes = FontAttributes.Bold;
            }

            layoutLabel.Children.Add(label);

            node.Children.Add(layoutCheck);

            if (temFilhos)
            {
                node.Children.Add(layoutImage);
            }

            if (Obj is CE_Pesquisa01)
            {
                label.Text = ((CE_Pesquisa01)Obj).nomepesquisa;
            }
            else
            {
                String nomeOnda  = ((CE_Pesquisa06)Obj).nome;
                String descricao = DateTime.Parse(((CE_Pesquisa06)Obj).dtiniciopesquisa).ToString("dd/MM/yy") + " - " + DateTime.Parse(((CE_Pesquisa06)Obj).dtfimpesquisa).ToString("dd/MM/yy");
                label.Text = nomeOnda + "\n" + descricao;
            }

            node.Children.Add(layoutLabel);

            /*if (Obj is CE_Pesquisa01)
             * {
             *  label.Text = ((CE_Pesquisa01)Obj).nomepesquisa;
             *  node.Children.Add(layoutLabel);
             * }
             * else
             * {
             *  String descricao = DateTime.Parse(((CE_Pesquisa06)Obj).dtiniciopesquisa).ToString("dd/MM/yy") + " - " + DateTime.Parse(((CE_Pesquisa06)Obj).dtfimpesquisa).ToString("dd/MM/yy");
             *  LabelItemArvorePesquisa labelItem = new LabelItemArvorePesquisa(descricao, temFilhos);
             *  labelItem.SetBinding(LabelItemArvorePesquisa.CommandProperty, new Binding("CmdShowFormulario", BindingMode.OneWay));
             *  labelItem.BindingContext = this.BindingContext;
             *
             *  node.Children.Add(labelItem);
             *
             * }*/

            IsExpanded = true;

            Children.Add(node);
        }