This is a migrated thread and some comments may be shown as answers.

Unpredictable results after altering the data source

4 Answers 61 Views
LoopingList
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Add-in Express
Top achievements
Rank 1
Add-in Express asked on 03 Jun 2013, 02:30 PM
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

4 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 04 Jun 2013, 06:09 AM
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.
0
Add-in Express
Top achievements
Rank 1
answered on 04 Jun 2013, 08:17 AM
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
0
Deyan
Telerik team
answered on 05 Jun 2013, 06:19 AM
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.
0
Add-in Express
Top achievements
Rank 1
answered on 05 Jun 2013, 06:39 AM
Hi Deyan,

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

Regards from Belarus,
Eugene Astafiev
Tags
LoopingList
Asked by
Add-in Express
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Add-in Express
Top achievements
Rank 1
Share this question
or