Пример #1
0
        private void InitTableView()
        {
            TableView.RegisterNibForCellReuse(MainPageItemViewCell.Nib, MainPageItemViewCell.Key);

            // Use simple table

            // var source = new BindableTableViewSource<CommandAction, MainPageItemViewCell>(
            //    ViewModel.Items.Values.ToList());

            // Use group table
            TableView.RegisterNibForHeaderFooterViewReuse(
                MainPageGroupHeaderViewCell.Nib,
                MainPageGroupHeaderViewCell.Key);

            var source = new BindableTableViewSource <string, CommandAction,
                                                      MainPageGroupHeaderViewCell, MainPageItemViewCell>(
                TableView,
                UICollectionElementKindSection.Header,
                ViewModel.Items)
            {
                HeightForRow       = 60f,
                HeightForGroupCell = 100f,
            };

            source.ItemClick = new RelayCommand <CommandAction>((action) => action.Command.Execute(null));

            TableView.Source = source;
        }
Пример #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(242, 242, 242);

            tableTaxiHailNetworkSettings.BackgroundView = new UIView {
                BackgroundColor = UIColor.Clear
            };
            tableTaxiHailNetworkSettings.BackgroundColor      = UIColor.Clear;
            tableTaxiHailNetworkSettings.SeparatorColor       = UIColor.Clear;
            tableTaxiHailNetworkSettings.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            tableTaxiHailNetworkSettings.DelaysContentTouches = false;

            var source = new BindableTableViewSource(
                tableTaxiHailNetworkSettings,
                UITableViewCellStyle.Subtitle,
                new NSString(CellId),
                string.Empty,
                UITableViewCellAccessory.None
                );

            source.CellCreator = CellCreator;
            tableTaxiHailNetworkSettings.Source = source;

            labelTaxiHailNetworkEnabled.Text            = this.Services().Localize["UserTaxiHailNetwork_Enabled"];
            labelTaxiHailNetworkEnabled.TextColor       = UIColor.FromRGB(44, 44, 44);
            labelTaxiHailNetworkEnabled.BackgroundColor = UIColor.Clear;
            labelTaxiHailNetworkEnabled.Font            = UIFont.FromName(FontName.HelveticaNeueLight, 32 / 2);

            // Horizontal line bellow master notification toggle
            var enabledToggleSeparator = Line.CreateHorizontal(0, labelTaxiHailNetworkEnabled.Superview.Frame.Height, this.View.Frame.Width, UIColor.LightGray, 1f);

            this.View.AddSubview(enabledToggleSeparator);

            // Adjust constraints for iOS7 (since there's no concept of margin)
            if (UIHelper.IsOS7)
            {
                // hardcoded values since there's only one width for iOS7 devices
                constraintLeftLabel.Constant   = -15;
                constraintRightSwitch.Constant = 17;
            }

            var set = this.CreateBindingSet <UserTaxiHailNetworkSettingsView, UserTaxiHailNetworkSettingsViewModel> ();

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.UserTaxiHailNetworkSettings);
            set.Bind(switchTaxiHailNetworkEnabled)
            .For(v => v.On)
            .To(vm => vm.IsTaxiHailNetworkEnabled);
            set.Bind(tableTaxiHailNetworkSettings)
            .For(v => v.Hidden)
            .To(vm => vm.IsTaxiHailNetworkEnabled)
            .WithConversion("BoolInverter");

            set.Apply();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(242, 242, 242);

            tableOrders.BackgroundView = new UIView {
                BackgroundColor = UIColor.Clear
            };
            tableOrders.BackgroundColor      = UIColor.Clear;
            tableOrders.SeparatorColor       = UIColor.Clear;
            tableOrders.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            tableOrders.DelaysContentTouches = false;

            lblNoHistory.Text   = Localize.GetValue("HistoryViewNoHistoryLabel");
            lblNoHistory.Hidden = true;

            var source = new BindableTableViewSource(
                tableOrders,
                UITableViewCellStyle.Subtitle,
                new NSString(CellId),
                CellBindingText,
                UITableViewCellAccessory.None
                );

            source.CellCreator = CellCreator;
            tableOrders.Source = source;

            var set = this.CreateBindingSet <HistoryListView, HistoryListViewModel> ();

            set.Bind(tableOrders)
            .For(v => v.Hidden)
            .To(vm => vm.HasOrders)
            .WithConversion("BoolInverter");

            set.Bind(lblNoHistory)
            .For(v => v.Hidden)
            .To(vm => vm.HasOrders);

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.Orders);
            set.Bind(source)
            .For(v => v.SelectedCommand)
            .To(vm => vm.NavigateToHistoryDetailPage);

            set.Apply();
        }
Пример #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.BackgroundColor = UIColor.FromRGB(242, 242, 242);

            tableLocations.BackgroundView = new UIView {
                BackgroundColor = UIColor.Clear
            };
            tableLocations.BackgroundColor      = UIColor.Clear;
            tableLocations.SeparatorColor       = UIColor.Clear;
            tableLocations.SeparatorStyle       = UITableViewCellSeparatorStyle.None;
            tableLocations.DelaysContentTouches = false;

            var source = new BindableTableViewSource(
                tableLocations,
                UITableViewCellStyle.Subtitle,
                new NSString(CellId),
                CellBindingText,
                UITableViewCellAccessory.None
                );

            source.CellCreator    = CellCreator;
            tableLocations.Source = source;

            var set = this.CreateBindingSet <LocationListView, LocationListViewModel> ();

            set.Bind(source)
            .For(v => v.ItemsSource)
            .To(vm => vm.AllAddresses);
            set.Bind(source)
            .For(v => v.SelectedCommand)
            .To(vm => vm.NavigateToLocationDetailPage);

            set.Apply();
        }