File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Core/TileControl Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -173,17 +173,21 @@ private async Task<bool> LoadImageBrushAsync(Uri uri)
173173 var loadCompletedSource = new TaskCompletionSource < bool > ( ) ;
174174 _brushVisual = compositor . CreateSurfaceBrush ( _imageSurface ) ;
175175
176- _imageSurface . LoadCompleted += ( s , e ) =>
176+ void LoadCompleted ( LoadedImageSurface sender , LoadedImageSourceLoadCompletedEventArgs args )
177177 {
178- if ( e . Status == LoadedImageSourceLoadStatus . Success )
178+ sender . LoadCompleted -= LoadCompleted ;
179+
180+ if ( args . Status == LoadedImageSourceLoadStatus . Success )
179181 {
180182 loadCompletedSource . SetResult ( true ) ;
181183 }
182184 else
183185 {
184186 loadCompletedSource . SetException ( new ArgumentException ( "Image loading failed." ) ) ;
185187 }
186- } ;
188+ }
189+
190+ _imageSurface . LoadCompleted += LoadCompleted ;
187191
188192 await loadCompletedSource . Task ;
189193 _imageSize = _imageSurface . DecodedPhysicalSize ;
You can’t perform that action at this time.
0 commit comments