Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Commented Issue: Accordion Throws Exceptions When Changing ItemsSource [3789]

$
0
0
When the accordion is set with a SelectionMode of "One" and the ItemsSource is changed there are two scenarios when a runtime exception is generated.

The first occurs when both the old and new values for the ItemsSource have at least one element in them. In this scenario UnselectItem will generate an RTE when calling ItemContainerGenerator.ContainerFromIndex(index).

The second occurs when the old value of ItemsSource has many elements and the new value has none. In this scenario UnselectItem will throw an RTE when attempting to access Items[0].

In the attached zip I have provided a small testing project which I used to reproduce these errors. I added the toolkit projects for local debugging. The first scenario can be reproduced using item source 1 then item source 2. The second scenario can be reproduced using item source 2 and then item source 3. The version of Accordion.cs alongside the project is one I have modified to no longer produce these errors. The modifications may or may not be entirely appropriate, but I think they will help illustrate some of the issues.
Comments: ** Comment from web user: zievw **

Please see attached behavior which solved this problem for me.

You use it by not defining ItemsSource on the Accordion itself but on the behavior instead:

<toolkit:Accordion>
<i:Interaction.Behaviors>
<behaviors:AccordionSafeItemsSourceBindingBehavior ItemsSource="{Binding MyList}"/>
</i:Interaction.Behaviors>
</toolkit:Accordion>


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>