我有一组我传递给Items
的对象。我想直接将 every 传递给 each 。我怎样才能做到这一点?JSection
LongListMultiSelector
JSection
controls:Section
导致运行时异常的 XAML:
<toolkit:LongListMultiSelector ItemsSource="{Binding Items}">
<toolkit:LongListMultiSelector.ItemTemplate>
<DataTemplate>
<controls:Section Data="{Binding}" />
</DataTemplate>
</toolkit:LongListMultiSelector.ItemTemplate>
</toolkit:LongListMultiSelector>
包含 XAML 的用户控件LongListMultiSelector
:
namespace Controls
{
public partial class RemoteHomePage : UserControl
{
public ObservableCollection<JSection> Items { get; set; }
public RemoteHomePage()
{
Items = new ObservableCollection<JSection> { };
Items.Add(new JSection { id = 2, name = "Section 2" });
Items.Add(new JSection { id = 1, name = "Section 1" });
Items.Add(new JSection { id = 3, name = "Section 3" });
InitializeComponent();
}
}
}
Section
班级:
namespace Controls
{
public partial class Section : UserControl
{
public JSection Data { get; set; }
public Section()
{
InitializeComponent();
}
}
}
我得到的例外:
An exception of type 'System.ArgumentException' occurred in mscorlib.ni.dll and wasn't handled before a managed/native boundary
An exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module. and wasn't handled before a managed/native boundary
An exception of type 'MS.Internal.NativeParseException' occurred in Unknown Module. and wasn't handled before a managed/native boundary
An exception of type 'System.Exception' occurred in Unknown Module. and wasn't handled before a managed/native boundary