Skip to content

Commit 7756fcd

Browse files
Add changes after review (developer)
1 parent bbf366f commit 7756fcd

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Readme.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,19 @@
55
[![](https://img.shields.io/badge/💬_Leave_Feedback-feecdd?style=flat-square)](#does-this-example-address-your-development-requirementsobjectives)
66
<!-- default badges end -->
77

8-
# WPF Accordion Control - Bind to data through the ChildrenSelector property
8+
# WPF Accordion Control - Bind to a data source that contains hierarchical data objects of different types
99

10-
This example binds the [AccordionControl](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.class) to data using the [AccordionControl.ChildrenSelector](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector.property) property.
10+
This example binds the [`AccordionControl`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl) to data objects of different types using the [`AccordionControl.ChildrenSelector`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector.property) property.
1111

1212
Refer to the [Data Binding](https://documentation.devexpress.com/WPF/118635/Controls-and-Libraries/Navigation-Controls/Accordion-Control/Data-Binding) topic for more information.
1313

1414
## Implementation details
1515

16-
In this example, the [AccordionControl](https://docs.devexpress.com/WPF/118347/controls-and-libraries/navigation-controls/accordion-control) is bound to a flat list of `Category` objects. Each `Category` stores a collection of `Item` objects in its `Items` property.
16+
The [`AccordionControl`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl) control uses the [`ChildrenSelector`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector) property to bind a flat list of `Category` objects. Each `Category` contains a collection of `Item` objects in its `Items` property.
1717

18-
To build a hierarchical view from the flat structure, the [AccordionControl](https://docs.devexpress.com/WPF/118347/controls-and-libraries/navigation-controls/accordion-control) uses the [`ChildrenSelector`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector.property) property. This property is set to a custom implementation of the `IChildrenSelector` interface:
18+
To build a hierarchical view, the [`AccordionControl`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl) needs to access child items dynamically. However, the data structure uses different object types (`Category` and `Item`) that do not share a common base class with a unified `Children` property. In this reason you cannot use the [`ChildrenPath`](https://docs.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenPath) property to specify the child collection name.
19+
20+
The [`AccordionControl`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl) control uses the [`ChildrenSelector`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector) property, which accepts a custom implementation of the `IChildrenSelector` interface. This technique allows the control to selectively return child items only for specific types:
1921

2022
```csharp
2123
public class MySelector : IChildrenSelector {
@@ -27,7 +29,7 @@ public class MySelector : IChildrenSelector {
2729
}
2830
```
2931

30-
In XAML, the selector is declared as a static resource and assigned to the [AccordionControl.ChildrenSelector](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector.property) property:
32+
In XAML, the selector is declared as a static resource and assigned to the [`AccordionControl.ChildrenSelector`](https://documentation.devexpress.com/WPF/DevExpress.Xpf.Accordion.AccordionControl.ChildrenSelector) property:
3133

3234
```xaml
3335
<local:MySelector x:Key="mySelector" />
@@ -37,7 +39,7 @@ In XAML, the selector is declared as a static resource and assigned to the [Acco
3739
ChildrenSelector="{StaticResource mySelector}" />
3840
```
3941

40-
The [AccordionControl](https://docs.devexpress.com/WPF/118347/controls-and-libraries/navigation-controls/accordion-control) uses data templates to display `Category` and `Item` objects:
42+
The [`AccordionControl`](https://docs.devexpress.com/WPF/118347/controls-and-libraries/navigation-controls/accordion-control) uses data templates to display `Category` and `Item` objects:
4143

4244
```xaml
4345
<DataTemplate DataType="{x:Type local:Category}">
@@ -64,6 +66,7 @@ The [AccordionControl](https://docs.devexpress.com/WPF/118347/controls-and-libra
6466
- [MVVM Framework](https://docs.devexpress.com/WPF/15112/mvvm-framework)
6567

6668
## More Examples
69+
6770
- [ WPF Accordion Control - Bind to Hierarchical Data Structure](https://github.com/DevExpress-Examples/wpf-accordion-bind-to-hierarchical-data-structure)
6871
- [WPF MVVM Framework - Use View Models Generated at Compile Time](https://github.com/DevExpress-Examples/wpf-mvvm-framework-view-model-generator)
6972
- [WPF Dock Layout Manager - Bind the View Model Collection with LayoutAdapters](https://github.com/DevExpress-Examples/wpf-docklayoutmanager-bind-view-model-collection-with-layoutadapters)

0 commit comments

Comments
 (0)