Hey Juan,

Thanks for such quick response, as a matter of fact, my approach was exactly 
like Your second solution.
But along the way I have made a mistake while assigning a new 
DialogViewController, here is the example of working solution:

public partial class MainViewController : DialogViewController
{
    List<string> newsList;
    List<StringElement> stringElementsList;

    public MainViewController () : base (UITableViewStyle.Grouped, null)
    {

       Root = new RootElement ("Main View") {};
       Section section = new Section ("");


        newsList = new List<string>()
        {
            "News - 1"
           ,"News - 2"
           ,"News - 3"
           ,"News - 4"
         };

         stringElementsList = new List<StringElement> (){};

         for (int i = 0; i < newsList.Count; i++) 
         {
            StringElement se = new StringElement(newsList[i]);
            section.Add(se);

            se.Tapped += () => 
            {
               //DialogViewController with modified ctor (string name)
                 DetailViewController dvc = new 
DetailViewController(newsList[se.IndexPath.Row]);
                 this.NavigationController.PushViewController(dvc,true);
             };

             stringElementsList.Add(se);
          }

          Root.Add (section);
    

     }
}



On Mar 5, 2013, at 8:11 PM, Juan M Gómez <[email protected]> wrote:

> Hi Iki,
> There are a few ways to go on:
> ->Just a specialized class of StringElement that exposes your properties or a 
> new event.
> ->If you assign the data in the same struct, just use it (if it is a loop, 
> remember to set a new assign in the block of lambda)
> 
> cheers
> 
> 
> Juan M Gómez
> 
> 
> 2013/3/5 Iki <[email protected]>
> Hi guys/gals,
> 
> I'm having trouble accessing MonoTouch Dialog elements. 
> 
> Example is: 
> 
> I have a list of items from which i create StringElements in section. After 
> elements is tapped, i would like to go to a new view, on which i would, based 
> on the element tapped filled out the data. 
> 
> StringElement.Tapped is without parameters,
> 
> se.Tapped += () => 
>                 {
> 
> 
>                 };
> 
>  and i can't find a proper way to send reference of the object that is tapped.
> 
> I'm currently using DialogViewControllers, for my main view, on which i 
> create list of name, and on my detail view which i need to fill up with data 
> based on element from the main view.
> 
> I did try with this
> 
> public void RowSelected (UITableView tableView, NSIndexPath indexPath)
> {
>     DetailViewController dvc = new DetailViewController (names 
> [indexPath.Row]);
>     this.NavigationController.PushViewController (dvc, true);
> }
> 
> But I don't see any effect. 
> 
> Thanks!
> 
> 
> 
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
> 
> 
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch

_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to