本文介绍了BitmapImage-> SetSource不更新Binding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有自定义ItemTemplate的ListView。在模板中,我有带有绑定的Image对象:
$
< Image Source =" {Binding AlbumArt}"余量= QUOT; 0" Stretch =" Uniform" />


接下来在app中我将ItemsSource设置为Object ^的向量^:

ctrlListView- > ItemsSource = m_items; (m_items是IVector< Object ^> ^)


在这个向量中我有我的TItem对象 其中我还有BitmapImage和任何其他字段(String ^)。当项目已经在m_items中(并且在ListView中可见)时,更新到BitmapImage不会更新ListView。如果
我会更改数据中的任何内容(它不会自动生效),我如何刷新ListView?

解决方案


I have a ListView with custom ItemTemplate. In the template i have Image object with Binding :
<Image Source="{Binding AlbumArt}" Margin="0" Stretch="Uniform"/>

Next in app i set ItemsSource to vector of Object^:
ctrlListView->ItemsSource = m_items; (m_items is IVector<Object^>^ )

In this vector i have my TItem objects where i have also BitmapImage and any other fields (String^). When items are already in m_items (and visible in ListView), then update to BitmapImage doesn't update ListView. How can i make ListView refreshed when i'll change anything in data (it does not work automatically) ?

解决方案


这篇关于BitmapImage-&gt; SetSource不更新Binding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-07 14:37
查看更多