简体   繁体   English

带图像的ItemTemplate

[英]ItemTemplate with image

Hello I am currently working on a project and are using Listbox.ItemTemplate. 您好,我目前正在研究一个项目,并且正在使用Listbox.ItemTemplate。 I am trying to make the template look like this: 我试图使模板看起来像这样:

      <ListBox.ItemTemplate>
            <DataTemplate>
                <Border BorderThickness="2" BorderBrush="Black" Margin="10" Width="100" Height="100" >
                //Image here//
                </Border>
            </DataTemplate>
        </ListBox.ItemTemplate>

The thing is that I add the items manually with the help of ac# method. 问题是我借助ac#方法手动添加了项目。 Does anyone know how I add a temple to a item as shown above? 有谁知道我如何向上面所示的物品添加一个镜腿?

If you add the template to the ListBox (as you've done above) then any items added to the listbox will have that template applied to them. 如果您将模板添加到ListBox (如上所述),则添加到列表框的所有项目都将应用该模板。 The template applies to all items in the listbox. 该模板适用于列表框中的所有项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM