Combobox Lost display information #19638

Closed
opened 2026-01-31 06:49:26 +00:00 by claunia · 2 comments
Owner

Originally created by @xyang-zh on GitHub (Apr 5, 2023).

Windows Terminal version

1.17.1023

Windows build number

10.0.22000.1761]

Other Software

Software:Visual stuidio 2022
Project:Window Terminal

Steps to reproduce

I am using visual studio 2022 to do new development on window terminal, but I encountered a problem that I don't know how to explain, so I had to seek an answer here,The steps are as follows:

Doing what

I tried to add a new combobox on the profile_base.xaml and manually set the combobox's SelectedItem and ItemsSource
Every time a Profile is opened, I update the value of the ItemsSource and notify the UI of the update

Here's the problem:

For example, the last time profile opened, the combobox itemsource has 7 values and the user choosed item6, the combobox display curr value is item6;
this time, the combobox itemsource has 5 values, but I want the UI to currently present the value that the user selected last time, that is item6. so, I manually set the SelectedItem still to be item6
However, when I update the content to 5 values(respectively item1, item2, item3, item4, item5), the current value displayed by the UI disappears, nothing
It looks like the SelectedItem display is missing because the ItemsSource does not contain this ite, is it because of this?

What should I do to achieve the results I want?

I don't have a deep understanding of the content of conbobox, so I hope you can give me some answers, thanks

Expected Behavior

When I update ItemsSource, the display keeps the last value

Actual Behavior

When I set SelectedItem manually, the display is empty

Originally created by @xyang-zh on GitHub (Apr 5, 2023). ### Windows Terminal version 1.17.1023 ### Windows build number 10.0.22000.1761] ### Other Software Software:Visual stuidio 2022 Project:Window Terminal ### Steps to reproduce I am using visual studio 2022 to do new development on window terminal, but I encountered a problem that I don't know how to explain, so I had to seek an answer here,The steps are as follows: ### Doing what I tried to add a new combobox on the profile_base.xaml and manually set the combobox's SelectedItem and ItemsSource Every time a Profile is opened, I update the value of the ItemsSource and notify the UI of the update ### Here's the problem: For example, the last time profile opened, the combobox itemsource has 7 values and the user choosed item6, the combobox display curr value is item6; this time, the combobox itemsource has 5 values, but I want the UI to currently present the value that the user selected last time, that is item6. so, I manually set the SelectedItem still to be item6 However, when I update the content to 5 values(respectively item1, item2, item3, item4, item5), the current value displayed by the UI disappears, nothing It looks like the SelectedItem display is missing because the ItemsSource does not contain this ite, is it because of this? ### What should I do to achieve the results I want? I don't have a deep understanding of the content of conbobox, so I hope you can give me some answers, thanks ### Expected Behavior When I update ItemsSource, the display keeps the last value ### Actual Behavior When I set SelectedItem manually, the display is empty
claunia added the Needs-TriageIssue-BugNeeds-Attention labels 2026-01-31 06:49:26 +00:00
Author
Owner

@zadjii-msft commented on GitHub (Apr 5, 2023):

Do you have a diff I could take a look at/? That might be the easiest way to investigate.

Kinda just sounds like a WinUI bug to be totally honest, but a diff would help me validate locally that it's not something unique to the Terminal's codebase 😄

@zadjii-msft commented on GitHub (Apr 5, 2023): Do you have a diff I could take a look at/? That might be the easiest way to investigate. Kinda just sounds like a WinUI bug to be totally honest, but a diff would help me validate locally that it's not something unique to the Terminal's codebase 😄
Author
Owner

@xyang-zh commented on GitHub (Apr 6, 2023):

Do you have a diff I could take a look at/? That might be the easiest way to investigate.

Kinda just sounds like a WinUI bug to be totally honest, but a diff would help me validate locally that it's not something unique to the Terminal's codebase 😄

Setting of combobox when opening a file for the first time (it showed it was right)

 itemsource:     std::vector<winrt::hstring> List{ L"COM1", L"COM3"}
 SelectedItem:   box_value(L"COM3)

first

Setting of combobox when opening a file for the second time (it showed it was wrong)

 itemsource:     std::vector<winrt::hstring> List{ L"COM1"}
 SelectedItem:   box_value(L"COM3)

second

@xyang-zh commented on GitHub (Apr 6, 2023): > Do you have a diff I could take a look at/? That might be the easiest way to investigate. > > Kinda just sounds like a WinUI bug to be totally honest, but a diff would help me validate locally that it's not something unique to the Terminal's codebase 😄 ### Setting of combobox when opening a file for the first time (it showed it was right) itemsource: std::vector<winrt::hstring> List{ L"COM1", L"COM3"} SelectedItem: box_value(L"COM3) ![first](https://user-images.githubusercontent.com/33871402/230399980-d4f4f069-c79e-4653-b005-69205c807826.png) ### Setting of combobox when opening a file for the second time (it showed it was wrong) itemsource: std::vector<winrt::hstring> List{ L"COM1"} SelectedItem: box_value(L"COM3) ![second](https://user-images.githubusercontent.com/33871402/230400882-535ab2b4-6564-45f0-9329-9f6a0e040fb5.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19638