mercredi 28 février 2018

Loop through checked checkboxes in grid and get labrl values WPF c#

i have a grid,inside that grid there's a stackpanel inside which there is one checkbox and 2 TextBlocks. The XAML is :

  <Grid x:name= "Maningrid" >
    <Stackpanel x:name="panel1">
       <Checkbox height="10" widht="10"/>
       <Textblock x:name="name1" text="a"/>
       <Textblock x:name="name2" text="b"/>
       <Textblock x:name="name3" text="c"/>
     </Stackpanel>
   </Grid>

Now, the thing is, inside MainGrid, i am dynamically adding panel1(the stackpanel) based on a list of random text.Anyway, what i want is , when i check the checkbox, the releavent Stackpanel(panel1)'s textblock values(name1,name2,name3's values) would be passed to a List(Of string) from where i can get the values of the three textblocks of each checked Checkboxes in stackpanels...Somewhat like the datagrid/datagridview(winforms) ..

I beg ur pardon if i failed to describe my wants properly but i hope u can understand what i'm looking for. I found this but as my motive and situation is entirely different, i can't really make use of the answer in that post...Any help/explanation of my idea ?




Aucun commentaire:

Enregistrer un commentaire