Home » SilverlightRSS

Binding to Accordion

Hello,

Does someone have an example of binding to an accordion?  I am trying it, but I think I'm missing something because it isn't displaying.

Thanks.

 

7 Answers Found

 

Answer 1

What kind of binding do you want to do on an accordion? On which dependency property do you want to bind what kind of data? Please give us some more informations.

 

Answer 2

Here's an example:

 

<z:Accordion x:Name="listCategories" DisplayMemberPath="{Binding Name}" Background="Transparent" BorderBrush="Transparent">
    <z:Accordion.HeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Name}" FontSize="12" Foreground="Black" />
        </DataTemplate>
    </z:Accordion.HeaderTemplate>
    <z:Accordion.ContentTemplate>
        <DataTemplate>
            <ListBox ItemsSource="{Binding Clips}" Margin="0,5,0,5" Width="200" VerticalAlignment="Top" Background="Transparent" BorderThickness="0" SelectionChanged="listClips_SelectionChanged">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Name}" FontSize="10" Foreground="Black" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </DataTemplate>
    </z:Accordion.ContentTemplate>
</z:Accordion>
 
 

Answer 3

Hi,

We have a plethora of accordion samples in the official Silverlight Toolkit samples @
 http://silverlight.net/samples/sl2/toolkitcontrolsamples/run/default.html?path=Layout|Accordion|Accordion%20Usage%20samples
Have a look under the "Generated Content" sample and around it.

 Sincerely,

 

Answer 4

 Hello,

Found my issue, and I mentioned the solution here: http://dotnetslackers.com/Community/blogs/bmains/archive/2009/04/28/silverlight-accordion-doesn-t-like-anonymous-types.aspx

It was an issue related to anonymous types.  Any ideas why this may be?

Thanks.

 

Answer 5

Silverlight does not support anonymous types databinding.

Anonymous types are generated as internal types, and Silverlight does not support non-public reflection.

This doesn't have anything to do with Accordion. It's a well known Silverlight issue.

Sincerely,

 

Answer 6

I figured it was based upon binding within the Silverlight framework.  Thanks.
 

Answer 7

We have a plethora of accordion samples in the official Silverlight Toolkit samples @
 http://silverlight.net/samples/sl2/toolkitcontrolsamples/run/default.html?path=Layout|Accordion|Accordion%20Usage%20samples
Have a look under the "Generated Content" sample and around it.


Um, no you don't!  That link is to SL2 example, in which you have absolutely no mention of the Accordian (If I remember right because it did not exist in SL2).


Try this link instead.

http://www.silverlight.net/content/samples/sl4/toolkitcontrolsamples/run/default.html?path=Layout|Accordion|Accordion%20Usage%20samples

Yell  Misinformation is more frustrating than lack of information.

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter