WPF ComboBox with custom dropdown width

北城余情 提交于 2021-01-03 07:24:28

问题


How can I extend width of dropdown of a combo, like Run dialog:


回答1:


Popup is a part of ComboBox template ("PART_Popup"). Add a Style for Popup to combobox Resources and set appropriate width there.

<ComboBox>
    <ComboBox.Resources>
        <Style TargetType="Popup">
            <Setter Property="Width" Value="1000"/>
        </Style>
    </ComboBox.Resources>
</ComboBox>

note also that there is a binding for Popup.MinWidth in template so you can't make it too small.



来源:https://stackoverflow.com/questions/43246876/wpf-combobox-with-custom-dropdown-width

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!