C# 带图像的项目模板
您好,我目前正在处理一个项目,正在使用Listbox.ItemTemplate。 我正在尝试使模板如下所示:C# 带图像的项目模板,c#,wpf,xaml,listbox,C#,Wpf,Xaml,Listbox,您好,我目前正在处理一个项目,正在使用Listbox.ItemTemplate。 我正在尝试使模板如下所示: <ListBox.ItemTemplate> <DataTemplate> <Border BorderThickness="2" BorderBrush="Black" Margin="10" Width="100" Height="100" > //
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="2" BorderBrush="Black" Margin="10" Width="100" Height="100" >
//Image here//
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
问题是,我在c方法的帮助下手动添加这些项。
有人知道我是如何将模板添加到如上所示的项目中的吗?如果您如上所述将模板添加到列表框中,则添加到列表框中的任何项目都将应用该模板。该模板适用于列表框中的所有项目