Search

Win Store App Listbox problem by DKiddTSI

Closed
as External Help for as External

1
0
Sign in
to vote
Type: Bug
ID: 777543
Opened: 1/25/2013 2:15:56 PM
Access Restriction: Public
0
Workaround(s)
0
User(s) can reproduce this bug
When a xaml page has more than one ListBox on it and both have a selected item, only the first ListBox will scroll to the selected item.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling Version

.NET Framework 4.5

Steps to reproduce

Create two classes :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace App1.Entities
{
    public class ContentEntity
    {
        public int Id { get; set; }
        public string Content { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace App1.Entities
{
    public class ListOfContent
    {
        List<ContentEntity> contentList;

        public List<ContentEntity> ObjectList
        {
            get
            {
                return contentList;
            }
            set
            {
                contentList = value;
            }
        }
    }
}


Create a simple page with this XAML:

<Page
    x:Class="App1.ListUsingCustomControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:App1"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<StackPanel x:Name="sp">
            <TextBlock Name="txt1" Text="Listbox 1" />
            <ListBox Name="lst1" Height="100"/>
            <TextBlock Name="txt2" Text="Listbox 2"/>
            <ListBox Name="lst2" Height="100"/>
        </StackPanel>
    </Grid>
</Page>

---------------------------
Put this C# code in the constructor:

this.InitializeComponent();

            var l = new List<ContentEntity>();

            for (var i = 1; i < 20; i++)
            {
                var c = new ContentEntity();
                c.Id = i;
                c.Content = "Cont " + i.ToString();
                l.Add(c);
            }

            var lobj = new ListOfContent();
            lobj.ObjectList = l;
            lst1.ItemsSource = lobj.ObjectList;
            lst1.SelectedValuePath = "Id";
            lst1.DisplayMemberPath = "Content";
            lst1.SelectedValue = 8;

            lst2.ItemsSource = lobj.ObjectList;
            lst2.SelectedValuePath = "Id";
            lst2.DisplayMemberPath = "Content";
            lst2.SelectedValue = 8;

Product Language

English

Operating System

Windows 8

Operating System Language

English

Actual results

The second ListBox does not autoscroll to the selected item

Expected results

The second ListBox should autoscroll to the selected item
File Attachments
File Name Submitted By Submitted On File Size  
WinStoreListBoxBug.zip 1/25/2013 373 KB
Sign in to post a comment.
Posted by Microsoft on 1/27/2013 at 9:23 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/25/2013 at 2:50 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.