locked
Does ContainerContentChanging work for a GridView when using an ItemTemplateSelector at the same time? RRS feed

  • Question

  • I am currently porting an app from Windows 8 to Windows 8.1 and would like to use the new mechanisms for better control over UI virtualization in a GridView.

    Basically, my GridView looks like this:

    <GridView Grid.Row="1" x:Name="tlGridView" VerticalContentAlignment="Center" VerticalAlignment="Center" ItemTemplateSelector="{StaticResource gridTemplateSelector}" IsItemClickEnabled="False" SelectionMode="None" ItemsSource="{Binding Items}" SelectedItem="{Binding Path=SelectedSegment,Mode=TwoWay}" Loaded="OnGridLoaded" ShowsScrollingPlaceholders="False">

    <GridView.ItemContainerTransitions> <TransitionCollection> <ContentThemeTransition/> <EntranceThemeTransition IsStaggeringEnabled="False"/> </TransitionCollection> </GridView.ItemContainerTransitions>

    </GridView>

    That is, I am using an ItemTemplateSelector which selects an appropriate template based on the item at hand. However, there is also some degree of randomness, meaning one and the same item can be displayed via a different template when it is displayed next time.

    And here comes my question: can I still use ContainerContentChanging in the same way as I would when not having an ItemTemplateSelector for my GridView? Or does ItemTemplateSelector affect ContainerContentChanging negatively?

    Thanks.






    • Edited by amikk Sunday, January 19, 2014 4:42 PM
    Sunday, January 19, 2014 4:35 PM

All replies

  • It is not clear that what are you trying to do with ContainerContentChanging, can you please explain?

    -- Vishal Kaushik --

    Please 'Mark as Answer' if my post answers your question and 'Vote as Helpful' if it helps you. Happy Coding!!!

    Sunday, January 19, 2014 5:17 PM
  • In most cases, one GridView item is bound to a list. The elements in this list are then mapped onto the cells of a specific Grid, whereby the Grid is selected by the ItemTemplateSelector.

    In phase 0, I would like to put placeholders into the cells of the Grid.

    In phase 1, I would like to replace the placeholders with the real elements (a custom control).

    Hopefully that makes things a bit clearer!?

    -Andreas



    • Edited by amikk Sunday, January 19, 2014 5:37 PM
    Sunday, January 19, 2014 5:26 PM