This question is locked. New answers and comments are not allowed.
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:
I wrote the following in the SelectedIndexChanged event handler of the first looping list control:
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
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