locked
Listview applies a check to other listview items having a checkbox when page navigation is returned

    Question

  • I have a listview of checkbox controls in which a check mark is mysteriously applied to other items within the listview when the page containing the listview has navigation returned to it.

    Specifically, I apply check marks to some items within the listview that contains roughly 300 items. I then tap a button that invokes another app to launch, and then when I return back to my original app with the listview and scroll down the listview, I observe a pattern of mysteriously checked checkboxes that follow the pattern of the original checked locations that I have made within the listview.

    NOTE:
    I am using virtualization within my listview.
    The mysterious checked checkboxes only occur when navigation is returned to the page containing the listview.

    Checkboxes should not get checked mysteriously.
    XAML:

      <ListView   x:Name="ContactList"
                    ItemsSource="{Binding SelectedCategory.Contacts}"
                    SelectedItem="{Binding SelectedContact, Mode=TwoWay}"
                    ScrollViewer.VerticalScrollMode="Enabled"
                    Height="600"
                    Width="425"
                    Margin="58,175,0,0"  Canvas.ZIndex="99"
                    Background="Transparent" Foreground="#FF333747"
                    VerticalAlignment="Top" HorizontalAlignment="Left">

            <ListView.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox x:Name="checkbox" Style="{StaticResource CheckBoxStyle1}"
                                  Visibility="{Binding ElementName=grid, Path=DataContext.BroadcastActivated, Converter={StaticResource BoolToVisibilityConverter}, Mode=TwoWay}"
                                  Margin="0,-8" BorderBrush="#FF4E58BC" Checked="ContactChecked" Unchecked="ContactUnchecked">
                        </CheckBox>

                        <TextBlock Text="{Binding DisplayName}" Width="425">
                            <Interactivity:Interaction.Behaviors>
                                <Core:EventTriggerBehavior EventName="Holding">
                                    <behaviors:MoveContactAction />
                                </Core:EventTriggerBehavior>
                            </Interactivity:Interaction.Behaviors>
                       
                            <FlyoutBase.AttachedFlyout>
                                <MenuFlyout>
                                    <MenuFlyoutItem Text="Family" Command="{Binding ElementName=grid, Path=DataContext.MoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                                    <MenuFlyoutItem Text="Friend" Command="{Binding ElementName=grid, Path=DataContext.MoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                                    <MenuFlyoutItem Text="Business" Command="{Binding ElementName=grid, Path=DataContext.MoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                                    <MenuFlyoutItem Text="Met" Command="{Binding ElementName=grid, Path=DataContext.MoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                                    <MenuFlyoutItem Text="Others" Command="{Binding ElementName=grid, Path=DataContext.MoveCommand}" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Text}" />
                                </MenuFlyout>
                            </FlyoutBase.AttachedFlyout>
                        </TextBlock>
                    </StackPanel>
                </DataTemplate>

            </ListView.ItemTemplate>

            <ListView.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel />
                </ItemsPanelTemplate>
            </ListView.ItemsPanel>

            <ListView.Template>
                <ControlTemplate TargetType="ListView">
                    <Border>
                        <ScrollViewer>
                            <ItemsPresenter/>
                        </ScrollViewer>
                    </Border>
                </ControlTemplate>
            </ListView.Template>

            <Interactivity:Interaction.Behaviors>
                <behaviors:ContactSelectionBehavior />
                <Core:DataTriggerBehavior Binding="{Binding DataContext.BusinessRequested, ElementName=grid}" Value="True">
                    <Core:GoToStateAction StateName="BusinessSelectedState"/>
                </Core:DataTriggerBehavior>
                <Core:DataTriggerBehavior Binding="{Binding DataContext.FriendsRequested, ElementName=grid}" Value="True">
                    <Core:GoToStateAction StateName="FriendsSelectedState"/>
                </Core:DataTriggerBehavior>
                <Core:DataTriggerBehavior Binding="{Binding DataContext.FamilyRequested, ElementName=grid}" Value="True">
                    <Core:GoToStateAction StateName="FamilySelectedState"/>
                </Core:DataTriggerBehavior>
                <Core:DataTriggerBehavior Binding="{Binding DataContext.OthersRequested, ElementName=grid}" Value="True">
                    <Core:GoToStateAction StateName="OthersSelectedState"/>
                </Core:DataTriggerBehavior>
                <Core:DataTriggerBehavior Binding="{Binding DataContext.AllRequested, ElementName=grid}" Value="True">
                    <Core:GoToStateAction StateName="AllSelectedState"/>
                </Core:DataTriggerBehavior>
                <Core:DataTriggerBehavior Binding="{Binding DataContext.MetRequested, ElementName=grid}" Value="True">
                 <Core:GoToStateAction StateName="MetSelectedState"/>
                </Core:DataTriggerBehavior>
            </Interactivity:Interaction.Behaviors>

            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="FontSize" Value="26" />
                    <Setter Property="Margin" Value="0,10" />
                    <Setter Property="Foreground" Value="#FF333747" />
                </Style>
            </ListView.ItemContainerStyle>
        </ListView>

    Tuesday, August 26, 2014 4:37 PM

All replies

  • do you have a sample project that you can share. its hard to find the problem with just the xaml. can be everywhere now. or at least post the code of the event handler of the checkbox

    Microsoft Certified Solutions Developer - Windows Store Apps Using C#

    Tuesday, August 26, 2014 5:18 PM
  • Thursday, August 28, 2014 12:40 AM
  • Any suggestions?
    Saturday, August 30, 2014 12:05 AM
  • Based on the lack of response from the source-code request that I responded to, I am recognizing this anomaly as a known bug within WinRT.
    • Edited by Bizmonger Saturday, September 06, 2014 3:40 PM
    Saturday, September 06, 2014 3:40 PM