Forum Xamarin.iOS

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Monotouch.Dialog how to get which checkbox element checked ?

Hello there,

I listed trade marks from list and create checkboxelement for each them.

***** Code is *******
for (z = 0; z <= dizi.Length -1 ; z++){
string[] kriter = dizi[z].ToString().Split('|');
KriterSectionMarka.Add ( new CheckboxElement (kriter [0].ToString() ,false,"XYZ"));
}


Above code is work well. You can see attachment file.

My question is how can i get which checkboxelement checked ?

for example it should give to me values HABA, NEMMER and TIGEX depends on image

i cant give static variable name for get value because it is for loop.

Thank for help

Posts

  • MikeCodesDotNetMikeCodesDotNet GBXamarin Team Xamurai
    edited January 2013

    Hi Yasin,

    As your looping through your list of trade marks you can create a new CheckboxElement.

    When you create the new element you can do something like this:

    CheckboxElement element;

    element = new CheckboxElement (kriter [0].ToString() ,false,"XYZ");

    element.ValueChanged += delegate
    {
    //Here we can put some code for handling that its been checked or unchecked.
    if(element.Value == true)
    {
    //Perhaps pop it in a list (outside of this scope) of selected items
    }else
    {
    //Remove the element from the list.
    }
    };

    This should work for you, I'm doing something similar in one of my apps. (sorry for formatting, I hit post reply to early)

Sign In or Register to comment.