public override UIView GetView( UIPickerView pickerView, nint row, nint component, UIView view )
        {
            nfloat width = pickerView.RowSizeForComponent(component).Width;
            nfloat height = pickerView.RowSizeForComponent(component).Height;

            var pickerCustomView = new UIView {
                Frame = new CGRect(0, 0, width - 10, height)
            };
            var pickerImageView = new UIImageView {
                Frame = new CGRect(20, height/4, height/2, height/2)
            };
            var pickerViewLabel = new UILabel {
                Frame = new CGRect(20 + height, 0, width - 10, height)
            };

            pickerCustomView.AddSubview(pickerImageView);
            pickerCustomView.AddSubview(pickerViewLabel);

            Category category = CategoryHelper.AllCategories[(int) row];

            pickerImageView.Image = new UIImage(category.IconSource);
            pickerViewLabel.BackgroundColor = UIColor.Clear;
            pickerViewLabel.Text = category.Name;
            pickerViewLabel.TextColor = category.Color.ToUIColor();

            return pickerCustomView;
        }
        public override UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
        {
            nfloat width  = pickerView.RowSizeForComponent(component).Width;
            nfloat height = pickerView.RowSizeForComponent(component).Height;

            var pickerCustomView = new UIView {
                Frame = new CGRect(0, 0, width - 10, height)
            };
            var pickerImageView = new UIImageView {
                Frame = new CGRect(20, height / 4, height / 2, height / 2)
            };
            var pickerViewLabel = new UILabel {
                Frame = new CGRect(20 + height, 0, width - 10, height)
            };

            pickerCustomView.AddSubview(pickerImageView);
            pickerCustomView.AddSubview(pickerViewLabel);

            Category category = CategoryHelper.AllCategories[(int)row];

            pickerImageView.Image           = new UIImage(category.IconSource);
            pickerViewLabel.BackgroundColor = UIColor.Clear;
            pickerViewLabel.Text            = category.Name;
            pickerViewLabel.TextColor       = category.Color.ToUIColor();

            return(pickerCustomView);
        }
        public override UIView GetView(UIPickerView picker, nint row, nint component, UIView view)
        {
            return(CoreUtility.ExecuteFunction <UIView> ("GetView", delegate()
            {
                float labelOffset = 30f;
                UIView vwPickerRow = new UIView(new CGRect(0f, 0f, picker.RowSizeForComponent(component).Width, picker.RowSizeForComponent(component).Height));
                UILabel lblPickerText = new UILabel(new CGRect(labelOffset, 0f, picker.RowSizeForComponent(component).Width - labelOffset, 40f));
                lblPickerText.Text = _dataSource[row].name;
                vwPickerRow.AddSubview(lblPickerText);
                vwPickerRow.BackgroundColor = UIColor.White;

                return vwPickerRow;
            }));
        }
예제 #4
0
            public override UIView GetView(UIPickerView picker, nint row, nint component, UIView view)
            {
                var size = picker.RowSizeForComponent(component);

                if (component == 0 || component == 1)
                {
                    if (view == null || view.Tag != kColorTag)
                    {
                        view = new UIView(new CGRect(0, 0, size.Width - 4, size.Height - 4))
                        {
                            Tag = kColorTag
                        };
                    }
                    view.BackgroundColor = Colors [row];
                }
                else
                {
                    if (view == null || view.Tag != kLabelTag)
                    {
                        view = new UILabel(new CGRect(0, 0, size.Width - 4, size.Height - 4))
                        {
                            Tag             = kLabelTag,
                            Opaque          = false,
                            BackgroundColor = UIColor.Clear
                        };
                    }
                    var label = (UILabel)view;
                    label.TextColor = UIColor.Black;
                    label.Text      = BlendModes [row];
                    label.Font      = UIFont.BoldSystemFontOfSize(18f);
                }
                return(view);
            }
예제 #5
0
        public override UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
        {
            if (view == null)
            {
                CGSize rowSize = pickerView.RowSizeForComponent(component);
                view = new UIView(new CGRect(0, 0, rowSize.Width, rowSize.Height - 10));
                int deltaX = -1;

                if (m_pics != null)
                {
                    deltaX = m_picSize;
                    var xamImageView = new UIImageView(new CGRect(0, 2, deltaX, deltaX));
                    xamImageView.Image = m_pics[(int)row];
                    view.AddSubview(xamImageView);
                }
                if (m_names != null)
                {
                    var textWidth  = deltaX > 0 ? rowSize.Width - deltaX + 5 : rowSize.Width;
                    var textHeight = rowSize.Height;
                    var textEdit   = new UITextView(new CGRect(deltaX + 1, 0, textWidth, textHeight));
                    textEdit.Editable        = false;
                    textEdit.TextColor       = UIColor.Black;
                    textEdit.BackgroundColor = UIColor.Clear;
                    textEdit.Text            = m_names[(int)row];
                    textEdit.Font            = m_font;
                    textEdit.TextAlignment   = Alignment;
                    textEdit.ContentInset    = new UIEdgeInsets(-5, 0, 0, 0);
                    view.AddSubview(textEdit);
                }
            }
            return(view);
        }
			/// <summary>
			/// Custom row view.
			///
			/// The <c>view</c> param is the reusable view for the row. It will be null initially.
			///
			/// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
			/// than every time this method is called.
			///
			/// Note that GetTitle() is no longer overridden since we aren't using the default row view
			/// </summary>
			public override UIView GetView (UIPickerView picker, nint row, nint component, UIView view)
			{
				//Lazy initialize
				if (view == null) {
					CGSize rowSize = picker.RowSizeForComponent (component);
					view = new UIView (new CGRect (new CGPoint (0, 0), rowSize));
				}
				//Modify state to reflect data
				view.BackgroundColor = Items [(int)row];
				return view;
			}
 /// <summary>
 /// Custom row view.
 ///
 /// The <c>view</c> param is the reusable view for the row. It will be null initially.
 ///
 /// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
 /// than every time this method is called.
 ///
 /// Note that GetTitle() is no longer overridden since we aren't using the default row view
 /// </summary>
 public override UIView GetView(UIPickerView picker, nint row, nint component, UIView view)
 {
     //Lazy initialize
     if (view == null)
     {
         CGSize rowSize = picker.RowSizeForComponent(component);
         view = new UIView(new CGRect(new CGPoint(0, 0), rowSize));
     }
     //Modify state to reflect data
     view.BackgroundColor = Items [(int)row];
     return(view);
 }
예제 #8
0
 /// <summary>
 /// Custom row view.
 ///
 /// The <c>view</c> param is the reusable view for the row. It will be null initially.
 ///
 /// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
 /// than every time this method is called.
 ///
 /// Note that GetTitle() is no longer overridden since we aren't using the default row view
 /// </summary>
 public override UIView GetView(UIPickerView picker, int row, int component, UIView view)
 {
     //Lazy initialize
     if (view == null)
     {
         SizeF rowSize = picker.RowSizeForComponent(component);
         view = new UIView(new RectangleF(new PointF(0, 0), rowSize));
     }
     //Modify state to reflect data
     view.BackgroundColor = items[row];
     return(view);
 }
예제 #9
0
        public override UIView GetView(UIPickerView pickerView, nint row, nint component, UIView view)
        {
            //Only work here, if move this method invoke to other position, pickerView.SubViews' count always 0
            this.UpdateDividerColor(pickerView, this.DividerColor);

            //var lbl = base.GetView(pickerView, row, component, view);
            var size = pickerView.RowSizeForComponent(component);
            var lbl  = new UILabel()
            {
                Frame         = new CoreGraphics.CGRect(0, 0, size.Width, size.Height),
                TextAlignment = UITextAlignment.Center
            };

            lbl.Text      = Values[(int)row];
            lbl.TextColor = this.TextColor;            // this.Element.TextColor.ToUIColor();
            lbl.Font      = UIFont.SystemFontOfSize(this.FontSize);

            return(lbl);
        }
			public override UIView GetView (UIPickerView picker, int row, int component, UIView view)
			{
				var size = picker.RowSizeForComponent (component);
				
				if (component == 0 || component == 1){
					if (view == null || view.Tag != kColorTag){
						view = new UIView (new RectangleF (0, 0, size.Width-4, size.Height-4)){
							Tag = kColorTag
						};
					}
					view.BackgroundColor = Colors [row];
				} else {
					if (view == null || view.Tag != kLabelTag){
						view = new UILabel (new RectangleF (0, 0, size.Width-4, size.Height-4)){
							Tag = kLabelTag,
							Opaque = false,
							BackgroundColor = UIColor.Clear
						};
					}
					var label = (UILabel) view;
					label.TextColor = UIColor.Black;
					label.Text = BlendModes [row];
					label.Font = UIFont.BoldSystemFontOfSize (18f);
				}
				return view;
			}
 /// <summary>
 /// Custom row view. 
 /// 
 /// The <c>view</c> param is the reusable view for the row. It will be null initially.
 /// 
 /// You can add subviews, etc., but prefer to do that in the lazy-initialization block rather
 /// than every time this method is called. 
 /// 
 /// Note that GetTitle() is no longer overridden since we aren't using the default row view
 /// </summary>
 public override UIView GetView(UIPickerView picker, int row, int component, UIView view)
 {
     //Lazy initialize
     if(view == null)
     {
         SizeF rowSize = picker.RowSizeForComponent(component);
         view = new UIView(new RectangleF(new PointF(0,0), rowSize));
     }
     //Modify state to reflect data
     view.BackgroundColor = items[row];
     return view;
 }