Unpredictable results after altering the data source

5 posts, 0 answers
  1. Add-in Express
    Add-in Express avatar
    15 posts
    Member since:
    Jan 2013

    Posted 03 Jun 2013 Link to this post

    Hello guys,

    I have got two looping list controls in my sample Windows Phone 8 app. If I select an item from the first list I need to update (alter the text displayed on the item) the other looping list (all items, not the selected one). That is why I try to use my own data source class:

    public class TestDataSource : LoopingListDataSource
    {
        ObservableCollection<LoopingListDataItem> loopingItems = new ObservableCollection<LoopingListDataItem>();      
     
        private int selectedNumberIndex;      
     
        public TestDataSource()
            : base(3)
        {
            loopingItems.Add(new LoopingListDataItem("1"));
            loopingItems.Add(new LoopingListDataItem("2"));
            loopingItems.Add(new LoopingListDataItem("3"));
        }
     
        public int SelectedNumberIndex
        {
            get
            {
                return this.selectedNumberIndex;
            }
            set
            {
                if (selectedNumberIndex != value)
                {
                    selectedNumberIndex = value;
                    OnPropertyChanged("SelectedNumberIndex");
                }
            }
        }
     
        protected override LoopingListDataItem GetItemCore(int index)
        {
            return loopingItems[index];
        }
     
        protected override void UpdateItemCore(LoopingListDataItem dataItem, int logicalIndex)
        {     
            loopingItems[logicalIndex].Text = selectedNumberIndex.ToString();
        }
    }

    I wrote the following in the SelectedIndexChanged event handler of the first looping list control:

    (secondList.DataSource as TestDataSource).SelectedNumberIndex = numbersList.SelectedIndex;

    Finally, I have attached two screenshots with my results. It looks like the CenteredItemSnapPosition and IsCentered properties were set somewhere in your code by mistake. However, it still returns the Middle value as was set in the markup. What is wrong with my code in that case?

    Regards from Belarus,
    Eugene Astafiev
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 04 Jun 2013 Link to this post

    Hi Eugene,

    Thanks for writing and for the code snippet.

    I am not quite sure why this happens based on your description and screenshots. It will be really helpful for me if you manage to send us a sample project which reproduces the scenario so that we can take a look and see what happens.

    Thanks for your time.

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Add-in Express
    Add-in Express avatar
    15 posts
    Member since:
    Jan 2013

    Posted 04 Jun 2013 Link to this post

    Hi Deyan,

    I have just uploaded a sample Windows Phone 8 application which reproduces the issue on my side. You can find it attached to the support ticket I opened yesterday.

    Regards from Belarus,
    Eugene Astafiev
  5. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 05 Jun 2013 Link to this post

    Hi Eugene,

    Please refer to your ticket for further details.

    Regards,
    Deyan
    Telerik
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  6. Add-in Express
    Add-in Express avatar
    15 posts
    Member since:
    Jan 2013

    Posted 05 Jun 2013 Link to this post

    Hi Deyan,

    Thank you. I've just answered you in the support ticket thread. Please check it out.

    Regards from Belarus,
    Eugene Astafiev
Back to Top
DevCraft banner