Skip to content

Bug: Binding issue #2458

Description

@premiaware

Description

I have try to convert my UWP App to net 10, but i have issue with binding
in the sample that i have attached i use Prism MVVM, this sample have issue for binding Observable collection to ListView. I have try to set also true or Including CsWinRT 2.2.0. but no work.

Steps To Reproduce

Prism.zip

the sample solution is in the folder

Prism\Sandbox\Windows10\HelloWorld\HelloWorld.sln

Build the solution and start it.

the listview in Xaml MainPage is in binding with viewModel

<ListView ItemsSource="{Binding DisplayItems, Mode=OneWay}" Header="Test list" >
     <ListView.ItemTemplate>
         <DataTemplate>
             <Grid>
                 <TextBlock Text="{Binding}" />
             </Grid>
         </DataTemplate>
     </ListView.ItemTemplate>
</ListView>

in the Code behind page:

        // uncomment this to bind the list to the UI
        // the App take correct data but from MainPageViewModel 
        // if you comment the App not work, not bind 

        //public ObservableCollection<string> DisplayItems
        //{
        //    get { return _DisplayItems; }
        //}

the ListView only works if the property "DisplayItems" is present in the “behind code” of the XAML page;
if it doesn't find it, the “Binding” doesn't work even if the context is set in the view model.
The strangest thing is that if it finds the “DisplayItems” property in the behind code, it uses that view model.

Expected Behavior

Without property in the code Behind the listview not work, even if the “viewModel” is set up correctly

Version Info

Last version.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions