Esempio n. 1
0
        public override void OnInitializeTextField()
        {
            base.OnInitializeTextField();
            ResultView       = new UIStackView();
            ResultView.Axis  = UILayoutConstraintAxis.Vertical;
            ResultView.Frame = this.Bounds;

            CollectionResult   = new UICollectionView(this.Bounds, new CollectionViewLeftFlowLayout());
            HeightOfCollection = NSLayoutConstraint.Create(CollectionResult, NSLayoutAttribute.Height, NSLayoutRelation.Equal, 1, 0);
            CollectionResult.AddConstraint(HeightOfCollection);

            ResultView.AddArrangedSubview(textField);
            ResultView.AddArrangedSubview(CollectionResult);

            CollectionResult.RegisterClassForCell(typeof(CollectionItemMultiCell), CellId);
            CollectionResultSource  = new CollectionResultSource(ResultItems);
            CollectionResult.Source = CollectionResultSource;

            CollectionMultiDelegate   = new CollectionMultiDelegate(ResultItems, CollectionResult.Frame.Width);
            CollectionResult.Delegate = CollectionMultiDelegate;

            CollectionViewLeftFlowLayout = new CollectionViewLeftFlowLayout();
            CollectionViewLeftFlowLayout.MinimumLineSpacing = 5f;
            CollectionResult.CollectionViewLayout           = CollectionViewLeftFlowLayout;

            uITapGestureRecognizer = new UITapGestureRecognizer(() =>
            {
                GestureAction(uITapGestureRecognizer);
            });
            uITapGestureRecognizer.NumberOfTapsRequired = 1;
            CollectionResult.UserInteractionEnabled     = true;
            CollectionResult.AddGestureRecognizer(uITapGestureRecognizer);
            CollectionResult.ReloadData();
        }