locked
Showing and Hiding Items in Templates RRS feed

  • Question

  • I have a xaml listview designed like the following below.  I want to programmatically show/hide colRecordingName, colRecordingTime, etc. However, when I try to type in colRecordingDate.visibility = collapsed, colRecordingDate can't be recognized. How do I show/hide this item?

    <ListView Grid.Row="0" Grid.Column="0" x:Name="lstVoices"   ItemsSource="{Binding}" HorizontalAlignment="Left"  VerticalAlignment="Top" Margin="20,0,0,20" Holding="lstVoices_Holding" ItemClick="lstVoices_ItemClick" SelectionChanged="lstVoices_SelectionChanged" SelectionMode="Single">
                            <ListView.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock x:Name="colFileName" Width="300" Text="{Binding Path=Name}" Style="{StaticResource ItemTextStyle}"   />
                                        <TextBlock x:Name="colRecordingDate" Width="80" Text="{Binding Path=RecordingDate,Converter={StaticResource FormatConverter}, ConverterParameter=\{0:d\}}"  Style="{StaticResource ItemTextStyle}" />
                                        <TextBlock x:Name="colRecordingTime" Width="40" Text="{Binding Path=RecordingDate,Converter={StaticResource FormatConverter}, ConverterParameter=\{0:t\}}"  Style="{StaticResource ItemTextStyle}" />
                                        <TextBlock x:Name="colDuration" Text="{Binding Path=Duration, Converter={StaticResource durationConverter}}" Style="{StaticResource ItemTextStyle}"   />
                                    </StackPanel>
                                </DataTemplate>
                            </ListView.ItemTemplate>
                        </ListView>     <!-- of lstVoices -->

    Sunday, September 23, 2012 9:31 AM

Answers

All replies