In the below XAML, the combobox is not visible. What am I doing wrong?
<Grid>
<StackPanel>
<ComboBox Name="combo1"
ItemsSource="{Binding}"
DisplayMemberPath="PartNumber" />
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0"
Grid.Column="0"
Text="{Binding ElementName=combo1, Path=SelectedItem.PartName}"
Background="AliceBlue" />
<TextBlock Grid.Row="0"
Grid.Column="1"
Text="{Binding ElementName=combo1, Path=SelectedItem.PartQuantity}"
Background="Beige" />
</Grid>
</Grid>
You have placed the grid above the combo box which causes the problem , you can either put a new row for the combo or use a canvas for specify the zIndex. Please checkout the xaml part below.