Skip to content

OneWay x:Bind on ListView.ItemsSource resets the source property if a setter is available #13433

@jeromelaban

Description

@jeromelaban

The Control:

        <ListView  ItemsSource="{x:Bind Items,Mode=OneWay}">
            <ListView.ItemTemplate>
               <TextBlock Text="{x:Bind }"/>
            </ListView.ItemTemplate>
        </ListView>

Data :

        publicObservableCollection<Item> Items { set; get; }  ,

In Constructor :

Items = new ObservableCollection<Item>(data_array);

Display Result:
no Item is displayed, but the Items actually have data . I also tried to use ListView.Items property in xaml ,it can correctly work.

Android (7.0) and WASM(firefox-latest) meet this error , WinUI is correct

Repro:
13433-ErrorProject-master.zip

Workaround

The workaround for this particular sample is to remove the ,Mode=OneWay from the ItemsSource binding, which is not needed (ItemsSource is never updated by ListView itself).

Other

Originally posted by @DJDQfff in #13428

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/listview 📃Categorizes an issue or PR as relevant to the ListView controlarea/xBind 🪢Categorizes an issue or PR as relevant to x:Bindhas-repro-branchproject/binding 🪢Categorizes an issue or PR as relevant to the binding enginetriage/potentially-fixedCategorizes an issue as potentially fixed by some unlinked PR, fix needs to be verified

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions