Replies: 1 comment 2 replies
-
Hey there, if I correctly understood what you want it's not complicated: <ListBox ItemsSource="{Binding List1}">
<ListBox.ItemTemplate>
<DataTemplate>
<Expander>
<!-- Expander Header or other properties here -->
...
<Expander.Content>
<ListBox ItemsSource="{Binding InnerList}">
</ListBox>
</Expander.Content>
</Expander>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox> From the docs "When binding, Avalonia performs a hierarchical search of the logical control tree, starting with the control where the binding is defined, until it finds a data context to use." If you need some more clarification feel free to ask! |
Beta Was this translation helpful? Give feedback.
-
I'm trying to implement a ListBox that displays a list of items (List1). Each item has an Expander component, and when the user expands it, I need to display another ListBox (or ItemsRepeater) inside the Expander.Content.
The inner ListBox should dynamically bind its ItemsSource to a property of the parent item in the data context. I'm struggling with how to properly set up this binding to access the parent property.
Beta Was this translation helpful? Give feedback.
All reactions