简体   繁体   中英

WP8.1 Combobox opens under other controls

I have a following problem, my combobox on winphone8.1 opens its items under others controls.. can anybody have any solve solutions?

<Grid>
  <Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="*"/>
    <RowDefinition Height="*"/>
  </Grid.RowDefinitions>

  <Combobox Grid.Row="0"/>
  <TextBox Grid.Row="1"/>
  <TextBox Grid.Row="2"/>
</Grid>

If you want your control to cover other items, instead of pushing them, just give your control a RowSpan. It makes the control span over multiple rows.

<Grid>
  <Grid.RowDefinitions>
    <RowDefinition Height="*"/>
    <RowDefinition Height="*"/>
    <RowDefinition Height="*"/>
  </Grid.RowDefinitions>

  <TextBox Grid.Row="1"/>
  <TextBox Grid.Row="2"/>
  <Combobox Grid.Row="0" Grid.RowSpan="3"/>
</Grid>

Notice that the Combobox is declared after the TextBoxes, in order to be in front of them and cover them.

On a sidenote, there's no need to explicitly set Grid.Row (or column) if it's 0 since that's its default value. So you could just ommit Grid.Row="0" on your Combobox. The same goes when setting * as height or width of a row/column defition. Can be shortened to

<RowDefinition/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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