We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If you try to use the ComboBox SelectedItem to select an entry within the ComboBox, the entry is not being selected.
NOTE that this use to work, but I am not sure which Visual Studio and/or WinAppSDK update changed this functionality.
I use to be able to load a ComboBox with strings, then select an item by setting SelectedItem = "myString";
Issue: instead of displaying the string the ComboBox's display remains blank.
You should be able to display an item within a ComboBox by setting its SelectedItem property in the same manner as setting its SelectedIndex property.
The code loads a ComboBox and tries to select an item by setting SelectedItem property.
However, the item is not selected and ComboBox is blank.
Blank ComboBox at startup:
ComboBox is properly populated:
Breakpoint shows SelectedItem property is null after selection:
Windows App SDK 1.6.0: 1.6.240829007
Packaged (MSIX)
No response
Visual Studio 2022
MainWindow.xaml
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> <ComboBox Name="ComboBoxMain"></ComboBox> </StackPanel>
MainWindow.xaml.cs public sealed partial class MainWindow : Window { public MainWindow() { this.InitializeComponent();
AddComboBoxMembers(); } private void AddComboBoxMembers() { int iIdx; string sItem; ComboBoxItem comboBoxItem; for (iIdx = 0; iIdx < 10; ++iIdx) { sItem = "Item" + iIdx.ToString(); comboBoxItem = new ComboBoxItem { Content = sItem, }; ComboBoxMain.Items.Add(comboBoxItem); } sItem = "Item5"; ComboBoxMain.SelectedItem = sItem; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
If you try to use the ComboBox SelectedItem to select an entry within the ComboBox, the entry is not being selected.
NOTE that this use to work, but I am not sure which Visual Studio and/or WinAppSDK update changed this functionality.
I use to be able to load a ComboBox with strings, then select an item by setting SelectedItem = "myString";
Steps to reproduce the bug
Issue: instead of displaying the string the ComboBox's display remains blank.
Expected behavior
You should be able to display an item within a ComboBox by setting its SelectedItem property in the same manner as setting its SelectedIndex property.
Screenshots
The code loads a ComboBox and tries to select an item by setting SelectedItem property.
However, the item is not selected and ComboBox is blank.
Blank ComboBox at startup:
ComboBox is properly populated:
Breakpoint shows SelectedItem property is null after selection:
NuGet package version
Windows App SDK 1.6.0: 1.6.240829007
Packaging type
Packaged (MSIX)
Windows version
No response
IDE
Visual Studio 2022
Additional context
MainWindow.xaml
MainWindow.xaml.cs
public sealed partial class MainWindow : Window
{
public MainWindow()
{
this.InitializeComponent();
The text was updated successfully, but these errors were encountered: