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)
173
173
var loadCompletedSource = new TaskCompletionSource < bool > ( ) ;
174
174
_brushVisual = compositor . CreateSurfaceBrush ( _imageSurface ) ;
175
175
176
- _imageSurface . LoadCompleted += ( s , e ) =>
176
+ void LoadCompleted ( LoadedImageSurface sender , LoadedImageSourceLoadCompletedEventArgs args )
177
177
{
178
- if ( e . Status == LoadedImageSourceLoadStatus . Success )
178
+ sender . LoadCompleted -= LoadCompleted ;
179
+
180
+ if ( args . Status == LoadedImageSourceLoadStatus . Success )
179
181
{
180
182
loadCompletedSource . SetResult ( true ) ;
181
183
}
182
184
else
183
185
{
184
186
loadCompletedSource . SetException ( new ArgumentException ( "Image loading failed." ) ) ;
185
187
}
186
- } ;
188
+ }
189
+
190
+ _imageSurface . LoadCompleted += LoadCompleted ;
187
191
188
192
await loadCompletedSource . Task ;
189
193
_imageSize = _imageSurface . DecodedPhysicalSize ;
You can’t perform that action at this time.
0 commit comments