簡體   English   中英

如何在C#中更改WPF ComboBox下拉寬度

[英]How can I change WPF ComboBox dropdown width in C#

我目前正在研究C#WPF項目,我似乎無法做的一件事是 - 如何更改ComboBox下拉寬度,因為每次我有項目時,下拉寬度采用最長項目(或字符串)的大小;

我該如何解決這個請幫助開發人員/程序員!!!!

像這樣設置ComboBoxItem的ItemContainerStyle:

 <ComboBox Width="50" Height="40">
        <ComboBox.ItemContainerStyle>
            <Style TargetType="ComboBoxItem">
                <Setter Property="Width" Value="60"/>
            </Style>
        </ComboBox.ItemContainerStyle>
        <ComboBoxItem Content="this is Item One "/>
        <ComboBoxItem Content="this is Item "/>
        <ComboBoxItem Content="this is "/>
        <ComboBoxItem Content="this "/>
    </ComboBox>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM