6
我们有一个带有用户控件的WPF页面,我们使用BitmapCache - 当我们试图通过用空路径(New Path())更新属性(数据绑定)来清除此元素时,它没有完全刷新/清除。如果我稍微改变窗口大小,BitmapCache激活的区域将被完全清除。WPF的BitmapCache没有完全清除
清除/刷新使用BitmapCache的元素有什么特别的做法吗?
这是我们的代码:
<me:ScrollViewer
RenderedWaves="{Binding RenderedWaves}"
ItemTemplate="{DynamicResource DataTemplateForWaveItem}"
ItemsPanel="{DynamicResource ItemsPanelTemplateForWaveItems}"
CacheMode="BitmapCache" />
我想我固定的,但它并不是屡试不爽......
此代码设置路径没有按” t立即更新BitmapCache:
Protected WriteOnly Property SetGraph As Path
Set(value As Path)
If value Is Nothing Then value = GetEmptyPath()
_graph = value
OnPropertyChanged(New PropertyChangedEventArgs(PropertyNameGraph))
End Set
End Property
而这种代码更新有时:
Protected WriteOnly Property SetGraph As Path
Set(value As Path)
UIDispatcherLocator.UIDispatcher.Invoke(Sub()
If value Is Nothing Then value = GetEmptyPath()
_graph = value
End Sub, Threading.DispatcherPriority.Background)
OnPropertyChanged(New PropertyChangedEventArgs(PropertyNameGraph))
End Set
End Property
您可能会告诉我们更多一点?为什么这么复杂? – 2012-08-10 13:25:04
如果我是一个博彩人,我会说你有vidya卡问题。你能提供一个最小的例子来表明repros? – Will 2012-08-10 13:26:47
您可以从代码隐藏中调用InvalidateVisual(),以查看是否有帮助 – ekholm 2012-08-10 13:30:30