locked
Show/Hide Specific ListView Items RRS feed

  • Question

  • I have a pretty standard listview that looks like this:

    <ListView x:Name="itemListView"
        AutomationProperties.AutomationId="ItemListView"
        AutomationProperties.Name="Grouped Items"
        ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
        ItemTemplate={StaticResource Standard80ItemTemplate}"
        IsItemClickEnabled="True"
        PointerReleased="itemListView_PointerReleased_1">
        <ListView.GroupStyle>
            <GroupStyle>
                <GroupStyle.HeaderTemplate>
                    <DataTemplate>
                        <Grid x:Name="MyItems">
                            <StackPanel Orientation="Vertical">
                                <StackPanel x:Name="Header">
                                    ....
                                </StackPanel>
                                <Grid x:Name="Details" Visibility="Collapsed">
                                    ....
                                </Grid>
                             </StackPanel>
                          ....
    

    I'm basically displaying a list of items, and each item consists of 2 parts; a header and a grid of item details. I'm hiding all item details by default and only displaying the headers for users to click. I want to show the details of whichever item header is clicked in the following handler:

    void itemListView_PointerReleased_1(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ e)
    {
        // Hide all item details
        // Show details of the item we just clicked
    }

    This is where I'm currently stuck; how would I get from Object^ sender to the UIElement I want to show/hide?

    Saturday, June 9, 2012 9:28 PM

Answers

All replies