开发者

Is it enough to set Binding Mode in ItemsSource?

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

            <ListBox ItemsSour开发者_运维技巧ce="{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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜