ListView Problem

Feb 12 2009 9:49 AM

In my double-click function, How to i access my grid (Name="Level2" @ line 17) so that I can set it visibility to visible for the selected row?

If there are any possible way to implement the change of visibility on double-clicking the selected row in WPF is also very welcome...

1 <StackPanel Margin="8">  
2  
3         <ListView Name="listView" ItemsSource="{Binding}" MouseDoubleClick="listView_MouseDoubleClick">  
4             <ListView.ItemTemplate> 
5                 <DataTemplate > 
6                     <Grid Name="GridMain" > 
7                         <Grid.RowDefinitions> 
8                             <RowDefinition></RowDefinition>  
9                             <RowDefinition></RowDefinition>  
10                         </Grid.RowDefinitions> 
11  
12                         <!--Level 1 --> 
13                         <Grid Name="Level1" Grid.Row="0" Height="20" > 
14                             <TextBlock Text="{Binding col0}" Name="AA" /> 
15                         </Grid> 
16  
17                         <!--Level 2 --> 
18                         <Grid Name="Level2" Grid.Row="1" Visibility ="Collapsed">  
19                             <Grid.ColumnDefinitions> 
20                                 <ColumnDefinition></ColumnDefinition>  
21                                 <ColumnDefinition></ColumnDefinition>  
22                             </Grid.ColumnDefinitions> 
23  
24                             <TextBlock Text="{Binding col1}" Grid.Column="0" Name="BB" /> 
25                             <TextBlock Text="{Binding col2}" Grid.Column="1" Name="CC"/>  
26                         </Grid> 
27  
28                     </Grid> 
29  
30                 </DataTemplate> 
31             </ListView.ItemTemplate> 
32         </ListView> 
33  
34     </StackPanel> 

Answers (1)