WPF ComboBox in Grid Issue

Posted by Nathan on Stack Overflow See other posts from Stack Overflow or by Nathan
Published on 2010-03-28T02:59:35Z Indexed on 2010/03/28 3:03 UTC
Read the original article Hit count: 391

Filed under:
|

I am trying to put a series of comboboxes in a grid and then I bind them to a list. For some reason unknown to me when I click the open button on the combobox nothing happens. If I move a comobobox outside the grid it opens just fine. Can someone please tell me what I am doing wrong here. It has to be something stupid because I've used comoboxes before just fine.

Here is my xaml:

<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="*" />
    </Grid.RowDefinitions>
    <GroupBox Header="Download Critera" Margin="70,30" Name="groupBox1" Grid.RowSpan="2">
        <Grid Height="Auto" Name="grid1" Width="Auto" Margin="0" IsHitTestVisible="False">
            <Grid.RowDefinitions>
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
                <RowDefinition  />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Row="1" Margin="10,5,5,5" Name="textBlock1" Text="A:" Foreground="Black" VerticalAlignment="Center" FontSize="14" FontWeight="Bold" />
            <TextBlock Grid.Row="2" Margin="10,5,5,5" Name="textBlock2" Text="B:" Foreground="Black" VerticalAlignment="Center" FontWeight="Bold" />
            <TextBlock Grid.Row="3" Margin="10,5,5,5" Name="textBlock3" Text="C:" Foreground="Black" VerticalAlignment="Center" FontWeight="Bold" />
            <TextBlock Grid.Row="4" Margin="10,5,5,5" Name="textBlock4" Foreground="Black" Text="D:" VerticalAlignment="Center" FontWeight="Bold" />
            <TextBlock Grid.Row="5" Margin="10,5,5,5" Name="textBlock5" Text="E:" Foreground="Black" TextAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" />

            <ComboBox x:Name="cb1" 
                      Grid.Column="1" Grid.Row="1" 
                      Margin="5" MaxDropDownHeight="100" 
                      ItemsSource="{Binding Projects}"/>

            <ComboBox x:Name="cb2" 
                      Grid.Column="1" Grid.Row="2" 
                      Margin="5" MaxDropDownHeight="100"
                      ItemsSource="{Binding Projects}"/>

            <ComboBox x:Name="cb3" 
                      Grid.Column="1" Grid.Row="3" 
                      Margin="5" MaxDropDownHeight="100"
                      ItemsSource="{Binding Projects}"/>

            <ComboBox x:Name="cb4" 
                      Grid.Column="1" Grid.Row="4" 
                      Margin="5" MaxDropDownHeight="100"
                      ItemsSource="{Binding Projects}"/>

            <ComboBox x:Name="cb5" 
                      Grid.Column="1" Grid.Row="5" 
                      Margin="5" MaxDropDownHeight="100"
                      ItemsSource="{Binding Projects}"/>
        </Grid>
    </GroupBox>
</Grid>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about combobox