Ejemplo n.º 1
0
        public BusinessObjects()
        {
            label  = new UILabel();
            label1 = new UILabel();
            button = new UIButton(UIButtonType.System);
            button.TouchUpInside    += OnButtonClicked;
            btnInput                 = new UIButton(UIButtonType.System);
            btnInput.TouchUpInside  += OnButtonInputClicked;
            btnImport                = new UIButton(UIButtonType.System);
            btnImport.TouchUpInside += OnButtonImportClicked;

            sfGrid    = new SfDataGrid();
            viewmodel = new BusinessObjectViewModel();
            sfGrid.AutoGenerateColumns = false;
            sfGrid.RowHeight           = 50;
            sfGrid.AllowEditing        = true;
            sfGrid.EditTapAction       = TapAction.OnTap;
            sfGrid.ColumnSizer         = ColumnSizer.Star;
            sfGrid.SelectionMode       = SelectionMode.None;
            sfGrid.HeaderRowHeight     = 40;
            sfGrid.ItemsSource         = viewmodel.CustomersInfo;

            GridTextColumn salesPerson = new GridTextColumn();

            salesPerson.MappingName         = "SalesPerson";
            salesPerson.HeaderText          = "Name";
            salesPerson.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridTextColumn salesJanJune = new GridTextColumn();

            salesJanJune.MappingName        = "SalesJanJune";
            salesJanJune.HeaderText         = "Jan-June";
            salesPerson.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridTextColumn salesJulyDec = new GridTextColumn();

            salesJulyDec.MappingName        = "SalesJulyDec";
            salesJulyDec.HeaderText         = "July-Dec";
            salesPerson.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            GridTextColumn change = new GridTextColumn();

            change.MappingName = "Change";
            change.HeaderText  = "Change";
            salesPerson.HeaderTextAlignment = UIKit.UITextAlignment.Center;

            sfGrid.Columns.Add(salesPerson);
            sfGrid.Columns.Add(salesJanJune);
            sfGrid.Columns.Add(salesJulyDec);
            sfGrid.Columns.Add(change);
            this.AddSubview(sfGrid);
        }
        public override View GetSampleContent(Context con)
        {
            LinearLayout linear = new LinearLayout(con);

            linear.SetBackgroundColor(Color.White);
            linear.Orientation = Orientation.Vertical;
            linear.SetPadding(10, 10, 10, 10);

            TextView text2 = new TextView(con);

            text2.TextSize      = 17;
            text2.TextAlignment = TextAlignment.Center;
            text2.Text          = "This sample allows you to import/export data from/to Business Objects.";
            text2.SetTextColor(Color.ParseColor("#262626"));
            text2.SetPadding(5, 5, 5, 5);

            linear.AddView(text2);

            m_context = con;

            Button btnInput = new Button(con);

            btnInput.Text   = "Input Template";
            btnInput.Click += ButtonInputClicked;
            linear.AddView(btnInput);

            Button btnImport = new Button(con);

            btnImport.Text   = "Import From Excel";
            btnImport.Click += ButtonImportClicked;
            linear.AddView(btnImport);

            btnExport         = new Button(con);
            btnExport.Text    = "Export To Excel";
            btnExport.Click  += ButtonExportClicked;
            btnExport.Enabled = false;
            linear.AddView(btnExport);

            sfGrid    = new SfDataGrid(con);
            viewmodel = new BusinessObjectViewModel();
            sfGrid.AutoGenerateColumns    = false;
            sfGrid.RowHeight              = 50;
            sfGrid.AllowEditing           = true;
            sfGrid.EditTapAction          = TapAction.OnTap;
            sfGrid.ColumnSizer            = ColumnSizer.Star;
            sfGrid.SelectionMode          = SelectionMode.None;
            sfGrid.HeaderRowHeight        = 40;
            sfGrid.ItemsSource            = viewmodel.CustomersInfo;
            sfGrid.VerticalOverScrollMode = VerticalOverScrollMode.None;

            GridTextColumn salesPerson = new GridTextColumn();

            salesPerson.MappingName = "SalesPerson";
            salesPerson.HeaderText  = "Name";
            //salesPerson.ItemsSource = viewmodel.CustomersInfo;
            salesPerson.HeaderTextAlignment = GravityFlags.Center;

            GridTextColumn salesJanJune = new GridTextColumn();

            salesJanJune.MappingName = "SalesJanJune";
            salesJanJune.HeaderText  = "Jan-June";
            // salesJanJune.ItemsSource = viewmodel.CustomersInfo;
            salesJanJune.HeaderTextAlignment = GravityFlags.Center;

            GridTextColumn salesJulyDec = new GridTextColumn();

            salesJulyDec.MappingName = "SalesJulyDec";
            salesJulyDec.HeaderText  = "July-Dec";
            //salesJulyDec.ItemsSource = viewmodel.CustomersInfo;
            salesJulyDec.HeaderTextAlignment = GravityFlags.Center;

            GridTextColumn change = new GridTextColumn();

            change.MappingName = "Change";
            change.HeaderText  = "Change";
            //salesJulyDec.ItemsSource = viewmodel.CustomersInfo;
            change.HeaderTextAlignment = GravityFlags.Center;

            sfGrid.Columns.Add(salesPerson);
            sfGrid.Columns.Add(salesJanJune);
            sfGrid.Columns.Add(salesJulyDec);
            sfGrid.Columns.Add(change);
            linear.AddView(sfGrid);
            return(linear);
        }