I have a UserControl that includes code that allows it to be moved on a map. This functionality has been working for months but - all of a sudden - it throws a run-time error. Here is the code:
Private Sub DotMouseLeftButtonUp(ByVal sender As Object, ByVal e As MouseButtonEventArgs) Handles Me.MouseLeftButtonUp
IsDragging = False
Dim DraggingDot As Dot = DirectCast(sender, Dot)
Dim Translate As TranslateTransform = DirectCast(DraggingDot.RenderTransform, TranslateTransform)
PreviousX = Translate.X
PreviousY = Translate.Y
DraggingDot.ReleaseMouseCapture()
End Sub
The line #4 throws this error:
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'System.Windows.Media.MatrixTransform' to type 'System.Windows.Media.TranslateTransform'.
So what's changed, you ask. Last night Microsoft upgraded Windows 10 to the latest release. I really don't like the new theme; but I digress. Nothing else (that I know of) has changed. Could that be the source of the problem? If so, should I report this to Microsoft?