Pergunta

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>
Foi útil?

Solução

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".

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top