0

I have a ListView and I want to access TextBox's item name in a method to change its visibility on mouse click event. How can I do it? Because it is not accessible.

<ListView Name="currentTasks"> 
     <ListView.ItemTemplate>
        <DataTemplate>
           <WrapPanel>
              <TextBlock Text="{Binding Name}"/>
              <TextBox Name="taskTextBox" Visibility="hidden"/>
           </WrapPanel>
        </DataTemplate>
     </ListView.ItemTemplate>
</ListView>

SOLUTION

Alright, I found out the solution. If you have similar problem then here is the link with the answer that helped me: https://stackoverflow.com/a/92765/17195987

Daniel
  • 1
  • 2
  • There are several ways, either you save the objects during the creation in a list or you ask "currentTasks" for his items, that you do with `currentTasks.Items`. – Schecher_1 Jul 09 '22 at 18:58
  • It's better and easier to follow the MVVM pattern (i.e. binding) instead of accessing the view by name in this case. – Hadi Fooladi Talari Jul 09 '22 at 19:50

0 Answers0