Silverlight组合框null项目高度

时间:2012-02-29 12:30:24

标签: c# .net silverlight xaml combobox

我有以下组合框:

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

Sign Collection是List,它的第一个元素是null。我的问题是,当我运行我的应用程序时,所有项目都正常显示但第一个(它为空)的高度非常小(它仍然存在且可选择)。所以,我的问题是我如何强迫它与其他一切一样高度。

2 个答案:

答案 0 :(得分:4)

你可以尝试一下吗?

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

希望它有所帮助。

答案 1 :(得分:0)

你可以尝试这个......希望这会对你有帮助。

<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>   

感谢。enter image description here

相关问题