-
Notifications
You must be signed in to change notification settings - Fork 785
Closed as not planned
Labels
area-ComboBoxbugSomething isn't workingSomething isn't workingno-issue-activityproduct-winui2team-ControlsIssue for the Controls teamIssue for the Controls team
Description
Describe the bug
I have this runtime type
[bindable]
[default_interface]
runtimeclass MyData
{
MyData();
Int32 Index{ get; set; };
Windows.Foundation.Collections.IObservableVector<String> Versions{ get; };
}And the code behind
struct MyData : MyDataT<MyData>
{
MyData() = default;
int Index()
{
return m_index;
}
void Index(int index)
{
m_index = index;
}
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> Versions() { return m_versions; }
winrt::Windows::Foundation::Collections::IObservableVector<winrt::hstring> m_versions = winrt::single_threaded_observable_vector<winrt::hstring>();
int m_index = 0;
};I have a ListView in MainPage.xaml using ItemTemplate
<ListView ItemsSource="{x:Bind data}">
<ListView.ItemTemplate>
<DataTemplate x:Name="template" x:DataType="local:MyData">
<ComboBox x:Name="box" SelectedIndex="{x:Bind Index}" ItemsSource="{x:Bind Versions}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>MainPage.idl
[default_interface]
runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
{
MainPage();
Windows.Foundation.Collections.IObservableVector<MyData> data{ get; };
}Fill the data in the code-behind
MainPage::MainPage()
{
InitializeComponent();
for (int i = 0; i < 1000; ++i)
{
MyData newData;
newData.Versions().Append(L"A");
newData.Versions().Append(L"B");
newData.Versions().Append(L"C");
newData.Versions().Append(L"D");
m_data.Append(newData);
}
}Steps to reproduce the bug
- Launch the app, and scroll a little bit down. You can see most of those
ComboBoxare not populated. Put a break point in theIndexsetter in theMyData.cpp, you can see the parameters are given a value of-1, while them_indexis actually initialized to0
Expected behavior
No response
Screenshots
NuGet package version
Microsoft.UI.Xaml 2.8.0
Windows app type
- UWP
- Win32
Device form factor
Desktop
Windows version
Windows 11 (22H2): Build 22621
Additional context
No response
HunterB06
Metadata
Metadata
Assignees
Labels
area-ComboBoxbugSomething isn't workingSomething isn't workingno-issue-activityproduct-winui2team-ControlsIssue for the Controls teamIssue for the Controls team
