Combobox windows phone 8.1 no dropdown
I am adding ComboBox to XAML for Windows Phone 8.1 in StackPanel. The dropdown function is not displayed in the emulator when launching the application. If I restrict the StackPanel to height eg. "70" only the first 2 items are displayed. If I say "Height =" Auto "then all elements are displayed at once.
How do I enable the dropdown function?
Title:
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Combobox ..
<StackPanel Grid.Row="4" Width="350" HorizontalAlignment="Left">
<TextBlock x:Name="PlayerListPanel" TextWrapping="Wrap" Text="Select a Player" VerticalAlignment="Center" Margin="2,0,0,0" HorizontalAlignment="Left"/>
<ComboBox Name="StartPlayerComboBox" BorderThickness="1" >
<ComboBoxItem Tag="PLAYER1">Player 1</ComboBoxItem>
<ComboBoxItem Tag="PLAYER2">Player 2</ComboBoxItem>
<ComboBoxItem Tag="PLAYER3">Player 3</ComboBoxItem>
<ComboBoxItem Tag="Dummy1">1</ComboBoxItem>
<ComboBoxItem Tag="Dummy2">2</ComboBoxItem>
<ComboBoxItem Tag="Dummy3">3</ComboBoxItem>
</ComboBox>
</StackPanel>
source to share
Try LISTPICKER control..Its functions like ComboBox with automatic height and width adjustments.
<toolkit:ListPicker>
<toolkit:ListPickerItem Content="A+" />
<toolkit:ListPickerItem Content="B+" />
<toolkit:ListPickerItem Content="O+" />
</toolkit:ListPicker>
to use this Include the following namespace in the Xaml page .. ADD windows phone toolkit (click on it)
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;
assembly=Microsoft.Phone.Controls.Toolkit"
if more information is required ... go back ...
source to share
You must provide sufficient opening height combobox
. If you are limiting the height, combobox
you can't go beyond that. This way it will only display a few items. Height = "Auto" means it can take any height as needed. Thus, it combobox
will take up the height necessary to open it correctly.
source to share
Combobox - Windows Phone / Windows RunTime Environment behaves differently than its Silverlight / WPF. Here we don't have a popup to display a list of items to select. Therefore, the dropdown menu needs enough space to display the options.
It is best to leave Height as Auto or MinWidth for any width requirement.
source to share
Even this, an old question, in addition to what they said already; the way to select an item by default, you need to "mark it" like this:
<ComboBoxItem IsSelected="True">Item 1</ComboBoxItem>
Then, once you click on it, you will see all the other combo box items (if you define them):
<ComboBox x:Name="myComboBox" VerticalAlignment="Top" Width="350" FontFamily="open sans" FontSize="20" Height="Auto" Foreground="DarkGray" BorderBrush="Black">
<ComboBoxItem IsSelected="True">Item 1</ComboBoxItem>
<ComboBoxItem>Item 2</ComboBoxItem>
<ComboBoxItem>Item 3</ComboBoxItem>
<ComboBoxItem>Item 4</ComboBoxItem>
</ComboBox>
Hope this helps someone. Relations
source to share