title: Monotouch Custon UIPicker get selected item
body: <p>This is my picker model class</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Drawing;
  using System.Linq;
  using MonoTouch.Foundation;
  using MonoTouch.UIKit;
  
  namespace Mobile.iOS
  {
      public class PickerDataModel : UIPickerViewModel
      {
          public event EventHandler&lt;EventArgs&gt; ValueChanged;
  
          public List&lt;string&gt; Items
          {
              get { return this._items;} 
              set { this._items = value;}
          }
          List&lt;string&gt; _items = new List&lt;string&gt;();
  
          public string SelectedItem
          {
              get { return this._items[this._selectedIndex]; }
          }
          protected int _selectedIndex = 0;
  
          public PickerDataModel()
          {   
          }
  
          public override int GetRowsInComponent (UIPickerView picker, int component)
          {
              return this._items.Count;
          }
  
          public override string GetTitle (UIPickerView picker, int row, int component)
          {
              return this._items[row];
          }
  
          public override int GetComponentCount (UIPickerView picker)
          {
              return 1;
          }
  
          public override void Selected (UIPickerView picker, int row, int component)
          {
              this._selectedIndex = row;
              if (this.ValueChanged != null)
              {
                  this.ValueChanged (this, new EventArgs());
              }
          }
      }
  }
  </code></pre>
  
  <p>Then I create an action sheet to show the UIPicker like this</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Drawing;
  using System.Linq;
  using MonoTouch.Foundation;
  using MonoTouch.UIKit;
  
  namespace Mobile.iOS
  {
      public class ActionSheetChildAgePicker
      {
          #region -= declarations =-
  
          UIActionSheet actionSheet;
          UIButton doneButton = UIButton.FromType (UIButtonType.RoundedRect);
          UIView owner;
          UILabel titleLabel = new UILabel ();
  
          #endregion
  
          #region -= properties =-
          public UIPickerView AgePicker
          {
              get { return agePicker; }
              set { agePicker = value; }
          }
          //create agepicker
          UIPickerView agePicker = new UIPickerView();
          /// &lt;summary&gt;
          /// The title that shows up for the date picker
          /// &lt;/summary&gt;
          public string Title
          {
              get { return titleLabel.Text; }
              set { titleLabel.Text = value; }
          }
  
  #endregion
  
          #region -= constructor =-
  
          /// &lt;summary&gt;
          /// 
          /// &lt;/summary&gt;
          public ActionSheetChildAgePicker (UIView owner)
          {
              // save our uiview owner
              this.owner = owner;
  
              // configure the title label
              titleLabel.BackgroundColor = UIColor.Clear;
              titleLabel.TextColor = UIColor.LightTextColor;
              titleLabel.Font = UIFont.BoldSystemFontOfSize (18);
  
              // configure the done button
              doneButton.SetBackgroundImage(UIImage.FromBundle ("ZurfersMovil-LoginBar-SignButton.png"), UIControlState.Normal);
              doneButton.SetTitleColor(MonoTouch.UIKit.UIColor.White, UIControlState.Normal);
              doneButton.SetTitle ("done", UIControlState.Normal);
              doneButton.TouchUpInside += (s, e) =&gt; { actionSheet.DismissWithClickedButtonIndex (0, true); };
  
              // create + configure the action sheet
              actionSheet = new UIActionSheet () { Style = UIActionSheetStyle.BlackTranslucent };
              actionSheet.Clicked += (s, e) =&gt; { Console.WriteLine ("Clicked on item {0}", e.ButtonIndex); };
  
  
  
              //Set picker Model and items
              PickerDataModel agePickerDataModel = new PickerDataModel();
              agePickerDataModel.Items.Add("&lt;2");
              agePickerDataModel.Items.Add("3");
              agePickerDataModel.Items.Add("4");
              agePickerDataModel.Items.Add("5");
              agePickerDataModel.Items.Add("6");
              agePickerDataModel.Items.Add("7");
              agePickerDataModel.Items.Add("8");
              agePickerDataModel.Items.Add("9");
              agePickerDataModel.Items.Add("10");
              agePickerDataModel.Items.Add("11");
              agePickerDataModel.Items.Add("12");
              agePickerDataModel.Items.Add("13");
              agePickerDataModel.Items.Add("14");
              agePickerDataModel.Items.Add("15");
              agePickerDataModel.Items.Add("16");
              agePickerDataModel.Items.Add("17");
              agePicker.Source = agePickerDataModel;
              agePicker.UserInteractionEnabled = true;
              agePicker.ShowSelectionIndicator = true;
  
  
              // add our controls to the action sheet
              //actionSheet.AddSubview (datePicker);
              actionSheet.AddSubview(AgePicker);
              actionSheet.AddSubview (titleLabel);
              actionSheet.AddSubview (doneButton);
          }
  
  #endregion
  
          #region -= public methods =-
  
          /// &lt;summary&gt;
          /// Shows the action sheet picker from the view that was set as the owner.
          /// &lt;/summary&gt;
          public void Show ()
          {
              // declare vars
              float titleBarHeight = 40;
              SizeF doneButtonSize = new SizeF (71, 30);
              SizeF actionSheetSize = new SizeF(owner.Frame.Width, agePicker.Frame.Height + titleBarHeight);
              RectangleF actionSheetFrame = new RectangleF (0, owner.Frame.Height - actionSheetSize.Height
                                                            , actionSheetSize.Width, actionSheetSize.Height);
  
              // show the action sheet and add the controls to it
              actionSheet.ShowInView (owner);
  
              // resize the action sheet to fit our other stuff
              actionSheet.Frame = actionSheetFrame;
  
              // move our picker to be at the bottom of the actionsheet (view coords are relative to the action sheet)
              agePicker.Frame = new RectangleF(agePicker.Frame.X, titleBarHeight, agePicker.Frame.Width, agePicker.Frame.Height);
  
              // move our label to the top of the action sheet
              titleLabel.Frame = new RectangleF (10, 4, owner.Frame.Width - 100, 35);
  
              // move our button
              doneButton.Frame = new RectangleF (actionSheetSize.Width - doneButtonSize.Width - 10, 7, doneButtonSize.Width, doneButtonSize.Height);
          }
  
          /// &lt;summary&gt;
          /// Dismisses the action sheet date picker
          /// &lt;/summary&gt;
          public void Hide (bool animated)
          {
              actionSheet.DismissWithClickedButtonIndex (0, animated);
          }
  
          #endregion  
      }
  }
  </code></pre>
  
  <p>Now on my view controller I trying to get the item selected like this but it doesn't work becuase I don't have a ValueChanged method.</p>
  
  <pre><code>actionSheetChildAgePicker.AgePicker.ValueChanged += (s, e) =&gt; {
                  this.txtAge1Room1 = f.ToString ((s as UIPickerView).Select(1,0,true));
              };
  </code></pre>
  
  <p>Any help would be appreciate. Thanks in advance.</p>