This question is locked. New answers and comments are not allowed.
Hi,
I have run into some strange behaviour, when changing the DataSource driving the RadLoopingList.
Steps:
So it seems that the problem only occurs the first time the DataSource is swapped, and only after the selected index was changed.
Any help is much appreciated in what helping resolve this problem
Thanks
Ryan
I have run into some strange behaviour, when changing the DataSource driving the RadLoopingList.
Steps:
- Change the selected item to number 10 (image 1.png)
- Press the application bar button, which will recreate the DataSource.
- Observe that the LoopingList jumps to the very top, and the selected item is not visible (image 2.png).
- Press the application bar button.
- Observe the selected item jumps to the center as expected.
<
telerikPrimitives:RadLoopingList
ItemWidth
=
"120"
ItemHeight
=
"120"
Width
=
"120"
IsCentered
=
"True"
DataSource
=
"{Binding DataSource}"
SelectedIndex
=
"{Binding SelectedIndex, Mode=TwoWay}"
/>
public
partial
class
MainPage : PhoneApplicationPage, INotifyPropertyChanged
{
LoopingListDataSource dataSource;
int
selectedIndex = -1;
public
MainPage()
{
InitializeComponent();
DataContext =
this
;
CreateDataSource();
}
public
LoopingListDataSource DataSource
{
get
{
return
dataSource; }
set
{ dataSource = value; NotifyPropertyChanged(
"DataSource"
); }
}
public
int
SelectedIndex
{
get
{
return
selectedIndex; }
set
{ selectedIndex = value; NotifyPropertyChanged(
"SelectedIndex"
); }
}
private
void
CreateDataSource()
{
DataSource =
new
LoopingListDataSource(1000);
dataSource.ItemNeeded += (sender, args) =>
{
args.Item =
new
LoopingListDataItem();
};
dataSource.ItemUpdated += (sender, args) =>
{
args.Item.Text = args.Index.ToString();
};
}
private
void
Button_Click(
object
sender, EventArgs e)
{
CreateDataSource();
}
public
event
PropertyChangedEventHandler PropertyChanged;
private
void
NotifyPropertyChanged(
string
propertyName)
{
if
(
null
!= PropertyChanged)
{
PropertyChanged(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
}
So it seems that the problem only occurs the first time the DataSource is swapped, and only after the selected index was changed.
Any help is much appreciated in what helping resolve this problem
Thanks
Ryan