[英]Changing ItemsPresenter in custom ComboBox style to display items next to each other
I want ComboBox to contain Images as items (they will be added programatically). 我希望ComboBox包含Images作为项目(它们将以编程方式添加)。 In default ComboBox they are displayed vertically.
在默认的ComboBox中,它们垂直显示。 I would like to have them to be displayed like in VariableSizedWrapGrid but I'm not exactly sure how to do it.
我想让它们像在VariableSizedWrapGrid中一样显示,但是我不确定如何做到。 I have this ItemsPresenter for ComboBox style but changing it to anything else results in nothing being displayed.
我具有用于ComboBox样式的ItemsPresenter ,但将其更改为其他任何样式都不会显示任何内容。
Or maybe I should make it other way (using ListView?). 或者也许我应该做其他方式(使用ListView?)。 I want selected item to be displayed like in ComboBox and after click all items displayed at once (around 25).
我希望所选项目像在ComboBox中一样显示,然后单击一次显示的所有项目(大约25个)。
How it looks now: 现在的样子:
What I want: 我想要的是:
Change the ItemsPanel
property: 更改
ItemsPanel
属性:
<ComboBox>
<ComboBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel/>
</ItemsPanelTemplate>
</ComboBox.ItemsPanel>
</ComboBox>
If you want to use something like VariableSizedWrapGrid
you can create your own implementation or check out other peoples work for example: VariableSizedWrapGrid for WPF . 如果要使用
VariableSizedWrapGrid
东西,则可以创建自己的实现或签出其他人的工作,例如: VariableSizedWrapGrid for WPF 。
I've made some research and it seems it's not possible to achieve what I want. 我进行了一些研究,似乎无法实现我想要的目标。 I'll just do it another way to get what I want ( Button with Flyout and ListView inside it should do the work).
我将以另一种方式获得我想要的东西(带有Flyout的 Button和其中的ListView应该可以完成工作)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.