<i id='yiwIh'><tr id='yiwIh'><dt id='yiwIh'><q id='yiwIh'><span id='yiwIh'><b id='yiwIh'><form id='yiwIh'><ins id='yiwIh'></ins><ul id='yiwIh'></ul><sub id='yiwIh'></sub></form><legend id='yiwIh'></legend><bdo id='yiwIh'><pre id='yiwIh'><center id='yiwIh'></center></pre></bdo></b><th id='yiwIh'></th></span></q></dt></tr></i><div id='yiwIh'><tfoot id='yiwIh'></tfoot><dl id='yiwIh'><fieldset id='yiwIh'></fieldset></dl></div>

  1. <tfoot id='yiwIh'></tfoot><legend id='yiwIh'><style id='yiwIh'><dir id='yiwIh'><q id='yiwIh'></q></dir></style></legend>

      <bdo id='yiwIh'></bdo><ul id='yiwIh'></ul>
  2. <small id='yiwIh'></small><noframes id='yiwIh'>

      如何将用户控件添加为列表框项

      how to add user controls as listbox items(如何将用户控件添加为列表框项)
      • <legend id='EiJNx'><style id='EiJNx'><dir id='EiJNx'><q id='EiJNx'></q></dir></style></legend>
          <i id='EiJNx'><tr id='EiJNx'><dt id='EiJNx'><q id='EiJNx'><span id='EiJNx'><b id='EiJNx'><form id='EiJNx'><ins id='EiJNx'></ins><ul id='EiJNx'></ul><sub id='EiJNx'></sub></form><legend id='EiJNx'></legend><bdo id='EiJNx'><pre id='EiJNx'><center id='EiJNx'></center></pre></bdo></b><th id='EiJNx'></th></span></q></dt></tr></i><div id='EiJNx'><tfoot id='EiJNx'></tfoot><dl id='EiJNx'><fieldset id='EiJNx'></fieldset></dl></div>

            <tbody id='EiJNx'></tbody>
            <bdo id='EiJNx'></bdo><ul id='EiJNx'></ul>

            <tfoot id='EiJNx'></tfoot>
            1. <small id='EiJNx'></small><noframes id='EiJNx'>

                本文介绍了如何将用户控件添加为列表框项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我正在使用 WPF .net 4.5 (c#),我想制作一个包含一系列用户控件的 ListBox.(如果列表框是错误类型的控件,请告诉我).

                I am using WPF .net 4.5 (c#) and I would like to make a ListBox that contains a series of user controls. (If a listbox is the wrong type of control, please let me know).

                我希望我的列表框有一个用户控件的副本作为列表项,每个项中有不同的内容.

                I want my listbox to have a copy of the user control as the list items, with different contents within each one.

                如何将用户控件添加到列表框?

                How do I add user controls to a listbox?

                提前感谢您的帮助!

                推荐答案

                您可以为列表框设置ItemTemplate,其中包含您的用户控件.

                You can set ItemTemplate for the listbox with your usercontrol in it.

                    <ListBox>
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <local:UserControl1/>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                

                谢谢

                这篇关于如何将用户控件添加为列表框项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                Cannot remove items from ListBox(无法从列表框中删除项目)
                Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)

                <i id='1Ea2q'><tr id='1Ea2q'><dt id='1Ea2q'><q id='1Ea2q'><span id='1Ea2q'><b id='1Ea2q'><form id='1Ea2q'><ins id='1Ea2q'></ins><ul id='1Ea2q'></ul><sub id='1Ea2q'></sub></form><legend id='1Ea2q'></legend><bdo id='1Ea2q'><pre id='1Ea2q'><center id='1Ea2q'></center></pre></bdo></b><th id='1Ea2q'></th></span></q></dt></tr></i><div id='1Ea2q'><tfoot id='1Ea2q'></tfoot><dl id='1Ea2q'><fieldset id='1Ea2q'></fieldset></dl></div>

                  <tbody id='1Ea2q'></tbody>
                  <legend id='1Ea2q'><style id='1Ea2q'><dir id='1Ea2q'><q id='1Ea2q'></q></dir></style></legend>

                  1. <tfoot id='1Ea2q'></tfoot>

                        • <bdo id='1Ea2q'></bdo><ul id='1Ea2q'></ul>
                        • <small id='1Ea2q'></small><noframes id='1Ea2q'>