简体   繁体   English

Silverlight组合框null项目高度

[英]Silverlight combobox null item height

I have following combobox: 我有以下组合框:

    <ComboBox x:Name="cmb2" ItemsSource="{Binding SignCollection, Mode=OneWay}"/>

Sign Collection is List and its first element is null. Sign Collection是List,其第一个元素为null。 My problem is that when i run my application all items shown normally but first one(which is null) has really small height(it's still there and selectable). 我的问题是,当我运行我的应用程序时,所有项目均正常显示,但第一个项目(为null)的高度确实很小(它仍然存在并且可以选择)。 So, my question is how can i force it to have same height as everything else. 因此,我的问题是我如何才能使其具有与其他所有物体相同的高度。

Could you try this? 你可以试试这个吗?

<ComboBox x:Name="cmb2" ItemsSource="{Binding SignCollection, Mode=OneWay}">
    <ComboBox.ItemContainerStyle>
         <Style TargetType="ComboBoxItem">
               <Setter Property="Height" Value="50"/>
         </Style>
    </ComboBox.ItemContainerStyle>
</ComboBox>
  • 50: example fixed height 50:示例固定高度

Hope it helps. 希望能帮助到你。

You can try this..hope this will help you. 您可以尝试此。.希望对您有帮助。

<ComboBox x:Name="cmbType" SelectedIndex="0" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="5,5,0,0" Width="250" Height="23" >
                    <ComboBoxItem>--Select Type--</ComboBoxItem>
                    <ComboBoxItem>Errors</ComboBoxItem>
                    <ComboBoxItem>Logs</ComboBoxItem>
</ComboBox>   

Thanks. 谢谢。 在此处输入图片说明

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

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