문제

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>
도움이 되었습니까?

해결책

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top