Hi,
If I use datacontext in page like this:
namespace SfAccordionSample
{
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.DataContext = new MyViewModel();
}
}
public class MyViewModel
{
public string MyText { get; set; }
}
}
XAML:
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:layout="using:Syncfusion.UI.Xaml.Controls.Layout"
x:Class="SfAccordionSample.MainPage"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBox Text="{Binding MyText}" Width="200" Margin="20"></TextBox>
<layout:SfAccordion HorizontalAlignment="Center" VerticalAlignment="Center" Height="500" Width="500">
<layout:SfAccordionItem Header="WinRT" Content="WinRT"/>
<layout:SfAccordionItem Header="Windows Phone" Content="Windows Phone"/>
<layout:SfAccordionItem Header="WPF" Content="WPF"/>
<layout:SfAccordionItem Header="Silverlight" Content="Silverlight"/>
</layout:SfAccordion>
</Grid>
</Page>
I get this errors:
Error: Converter failed to convert value of type 'SfAccordionSample.MyViewModel' to type 'DataTemplate'; BindingExpression: Path='' DataItem='SfAccordionSample.MyViewModel'; target element is 'Syncfusion.UI.Xaml.Controls.Layout.SfAccordionItem' (Name='null'); target property is 'ContentTemplate' (type 'DataTemplate').
Error: Converter failed to convert value of type 'SfAccordionSample.MyViewModel' to type 'DataTemplate'; BindingExpression: Path='' DataItem='SfAccordionSample.MyViewModel'; target element is 'Syncfusion.UI.Xaml.Controls.Layout.SfAccordionItem' (Name='null'); target property is 'HeaderTemplate' (type 'DataTemplate').
What I am doing wrong, or this is a bug?
Thanks,
Radim