Hello, I created a user control which contains a ListView with a custom ItemsPanelTemplate.
<UserControl x:Class="..."
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Name="thisUserControl">
<ListView ItemsSource="{Binding Source={StaticResource cvs}}"
Name="mainListView">
<ListView.GroupStyle>
<GroupStyle>
...
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<cd:TimeLinePanel UnitsPerSecond="{Binding ElementName=thisUserControl,Path=DataContext.UnitsPerSecond}" Start="{Binding ElementName=thisUserControl, Path=DataContext.Start}"/>
</ItemsPanelTemplate>
</ListView.ItemsPanel>
</ListView>
The DataContext of the UserControl has two properties Start and UnitsPerSecond. As I am using groups I cannot simply write
Start={Binding Path=.Start}
Thus I used the code above. But if I change the binding of Start to this I get an exception:
VisualTree of ItemsPanelTemplate must be a single element.
Obviously the ItemsPanelTemplate has got just a single element.
So what could be the problem? My custom panel does not create any elements. It just arranges them.
Thanks in advance.