The Media Center Sandbox

Resources and discussion for developing experiences in the Windows Media Center platform.
Welcome to The Media Center Sandbox Sign in | Join | Help
in Search

Do you consider this a repeater bug?

Last post 01-22-2008, 9:48 AM by Charlie. 3 replies.
Sort Posts: Previous Next
  •  01-19-2008, 3:12 AM 6183

    Do you consider this a repeater bug?

     

       If you have a Repeater element that contains the Options of a Choice object, you often want to synchronise the selected item in the repeater with the Chosen item in the Choice object.

       One of the techniques to do this is using ChosenIndex - you can set the ChosenIndex of the Choice object to the RepeatedItemIndex that is found in the Repeater.

     

       However, if your Repeater can repeat, the RepeatedItemIndex number keeps going. So if you move to the item after the last one (let's say you have 100 items in your Choice and Repeater and are moving from the 100th back to the first), rather than going back to '1', you instead get index #101 - which immediately crashes your program with an exception.

       The same thing applies to going backwards. Rather than going to 100, it goes to -1.

       Is this by design? Or is it a bug? If it IS by design, is there any justification for this sort of behaviour?

  •  01-19-2008, 1:57 PM 6187 in reply to 6183

    Re: Do you consider this a repeater bug?

    yeah that one is a complete pitb...  (im sure it's probably intentional - but never understood why myself - given that the VirtualList class would have sufficied for this sort of thing).

    this 'feature' makes it also imposible to properly utilize Anchor/FormLayout style inside lists that have the autorepeat enabled - the bit that always caused me the most grief ....  On a few occasions I've turned off the auto repeating and actually doubled up on the list items just so I'm not impacted by this (but not very efficient memory wise).

     

     

     

  •  01-19-2008, 9:49 PM 6188 in reply to 6187

    Re: Do you consider this a repeater bug?

    We solved this problem for Internet TV with a <Rules> set that looked something like this...

    Rule 1
    On RepeatedItemIndex.Changed
    If RepeatedItemIndex > Choice.Options.Count And Choice.HasNextValue == false
    Set RepeatedItemIndex = 0

    Rule 2
    On RepeatedItemIndex.Changed
    If RepeatedItemIndex < 0 And Choice.HasPreviousValue == false
    Set RepeatedItemIndex = Choice.Options.Count

    If you can't figure it out with this information let me know and I'll try to find an actual MCML sample.

  •  01-22-2008, 9:48 AM 6225 in reply to 6188

    Re: Do you consider this a repeater bug?

    Ah, more information...

    RepeatedItemIndex should have two values:

    1) Value
    2) SourceValue

    Value is the “virtualized” visual index that can extend outside of the data range.
    SourceValue will be an index that is safe to use with the Repeater’s Source list.

    See http://msdn2.microsoft.com/en-us/library/bb189729.aspx for more information.

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems