This question is locked. New answers and comments are not allowed.
I'm using the RadLoopingList control in an app in a way that uses multiple lists together to spell out a word. For example each of 5 RadLoopingLists contains the letters A-Z, and selecting a different item in each list spells out a 5-letter word.
When scrolling finishes on one of the controls, I raise an event and pass through the values of the 5 scrollers added together into a word, and then check if this word matches the 'answer'. It works really well, except...
If I rapidly spin through the controls and then select the correct values, the value passed does not match the items selected. It's as if rapidly scrolling through the lists makes the SelectedIndex and actual value get out of sync (e.g. "ABCDE" is displayed on the screen but "AABDE" is the value returned).
FWIW I use the code below to detect when a value changes and to subsequently raise my event. The InputChanged sub simply gets the current values of each of the loopers and creates a string. The string is always correct unless the scrollers have gone through a lot of movement before selecting the letters.
The only thing I can think of is that I can't figure out how to set the height of my scrollers so that the exact amount of items are in the list (e.g. I have just removed my height properties to let the control keep its default, and it only allows 3 of the 7 items to be selected in the looper). Some of my scrollers need 26 items (for A-Z), some need 5 (for 5 different images), and others need various other number of items. I have been using trial-and-error to set the height property on my RadLoopingList controls so that all the items fit without and repetition or missing items (leaving the Height blank/default results in the wrong number of items for some reason). Am I missing something? Is this the root of my issue (perhaps the control is determining the selected item by calculating the pixels, but my incorrect height is introducing a margin of error?).
I'm not sure if posting any other code will help at this stage. Everything DOES work if I don't first randomly scroll through the items (which I'm sure some end users will do). I have also tried using the SelectedIndexChanged event instead of the ScrollCompleted with exactly the same results.
Here is the XAML for one of my controls (with no height specified - this leads to too few items displaying):
And the corresponding datatemplate:
Any ideas what I'm doing wrong? Are there any more details I can provide?
When scrolling finishes on one of the controls, I raise an event and pass through the values of the 5 scrollers added together into a word, and then check if this word matches the 'answer'. It works really well, except...
If I rapidly spin through the controls and then select the correct values, the value passed does not match the items selected. It's as if rapidly scrolling through the lists makes the SelectedIndex and actual value get out of sync (e.g. "ABCDE" is displayed on the screen but "AABDE" is the value returned).
FWIW I use the code below to detect when a value changes and to subsequently raise my event. The InputChanged sub simply gets the current values of each of the loopers and creates a string. The string is always correct unless the scrollers have gone through a lot of movement before selecting the letters.
The only thing I can think of is that I can't figure out how to set the height of my scrollers so that the exact amount of items are in the list (e.g. I have just removed my height properties to let the control keep its default, and it only allows 3 of the 7 items to be selected in the looper). Some of my scrollers need 26 items (for A-Z), some need 5 (for 5 different images), and others need various other number of items. I have been using trial-and-error to set the height property on my RadLoopingList controls so that all the items fit without and repetition or missing items (leaving the Height blank/default results in the wrong number of items for some reason). Am I missing something? Is this the root of my issue (perhaps the control is determining the selected item by calculating the pixels, but my incorrect height is introducing a margin of error?).
I'm not sure if posting any other code will help at this stage. Everything DOES work if I don't first randomly scroll through the items (which I'm sure some end users will do). I have also tried using the SelectedIndexChanged event instead of the ScrollCompleted with exactly the same results.
Here is the XAML for one of my controls (with no height specified - this leads to too few items displaying):
<
Grid
Height
=
"140"
x:Name
=
"LayoutRoot"
Background
=
"#FFBABABA"
>
<
Controls:RadLoopingList
x:Name
=
"looper1"
IsCentered
=
"True"
ItemHeight
=
"96"
ItemWidth
=
"96"
Margin
=
"0,0,0,0"
ItemTemplate
=
"{StaticResource LoopTemplateImageLarge}"
IsExpanded
=
"False"
Foreground
=
"Black"
ItemSpacing
=
"0"
BorderBrush
=
"Black"
HorizontalAlignment
=
"Left"
HorizontalContentAlignment
=
"Stretch"
IsLoopingEnabled
=
"True"
VerticalAlignment
=
"Center"
Width
=
"96"
/>
And the corresponding datatemplate:
<
DataTemplate
x:Key
=
"LoopTemplateImageLarge"
>
<
Grid
Width
=
"96"
Height
=
"96"
Background
=
"Black"
>
<
Image
Source
=
"{Binding Text}"
HorizontalAlignment
=
"Left"
Height
=
"96"
Margin
=
"0"
VerticalAlignment
=
"Top"
Width
=
"96"
/>
</
Grid
>
</
DataTemplate
>
Private
Sub
looper1_ScrollCompleted(sender
As
Object
, e
As
LoopingList.LoopingListScrollEventArgs)
Handles
looper1.ScrollCompleted
looper1.IsExpanded =
False
InputChanged()
End
Sub
Any ideas what I'm doing wrong? Are there any more details I can provide?