Question

Is this redundant (Mode=OneTime in each TextBlock) ?

            <ListBox ItemsSource="{Binding Path=SearchResultsItems, Mode=OneTime}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                            <StackPanel>
                                <TextBlock Text="{Binding Path=Price, Mode=OneTime}" />
                                <TextBlock Text="{Binding Path=Description, Mode=OneTime}" />
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
Was it helpful?

Solution

I don't think so. Setting ItemsSource to OneTime concerns the collection of item, not the items themselves. ItemsSource = OneTime really means "if item collection change after initializing, do not update my ListBox".

OTHER TIPS

I don't think so.

If the binding on the itemssource is mode OneTime you shouldn't get a property change when you change the list (add or remove items) but you'll still get property changes from the properties of the list items.

So if you don't want to display price or description changes on your items you should keep Mode=OneTime on the textblocks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top