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