views:

17

answers:

1

I'm dynamically creating multiple expandable panel in silverlight. Every panel contains textbox. I need to bind this textbox to parent expandable panel header property.

How to do it dynamically?

A: 
<Textbox.Text="{Binding Path=Header RelativeSource={RelativeSource Mode="FindAncestor" AncestorType="{x:Type ExpandablePanel}}}"/>
Ozan
ebattulga
@ebattulga: Sorry, I guess you need to set up the Binding to use the x:Name of the ExpandablePanel: {Binding Path=Header ElementName=panel1} etc.If you create the panels by template you can use the TemplatedParent mode of the RelativeSource.
Ozan