jeudi 20 avril 2023

Is there a way to dynamically name/control checkboxes in visual basic?

I have xaml code that creates a list view with two columns; the first column is checkboxes based on the number of items that are in the second column. The issue with the way the code is written is the checkboxes do not have their own names (as far as I can tell). If i rename the object then all 15 of the checkboxes will be named the same thing not allowing me control over what happens if any one is checked (I think). Is there a way I can code it to where they have independent control from one another?

This is what I used to create this far

<Grid>
   <ListView Grid.Row="2" Grid.Column="2" ItemsSource="{Binding XPath=..//@ParentAttribute}">
      <ListView.View>
         <GridView>
            <GridViewColumn Header="Selection">
               <GridViewColumn.CellTemplate>
                   <DataTemplate>
                      <CheckBox Name="Check"/>
                   </DataTemplate>
               </GridViewColumn.CellTemplate>
            </GridViewColumn>
            <GridViewColumn>
            </GridViewColumn>
         </GridView>
      </ListView.View>
   </ListView>
</Grid>



Aucun commentaire:

Enregistrer un commentaire