We have a WPF Page with a user control where we use a BitmapCache - when we try to clear this element by updating the property (Data Binding) with an empty Path (New Path()), it is not completely refreshed/cleared. If I change the window size a little bit the area where the BitmapCache is active is completely cleared.
Is there something special to do to clear/refresh an element that uses BitmapCache?
This is our code:
<me:ScrollViewer
RenderedWaves="{Binding RenderedWaves}"
ItemTemplate="{DynamicResource DataTemplateForWaveItem}"
ItemsPanel="{DynamicResource ItemsPanelTemplateForWaveItems}"
CacheMode="BitmapCache" />
I thought I fixed it, but it works not every time...
This code to set the path doesn't update the BitmapCache immediately:
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
And this code updates it sometimes:
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