wpf listbox image The process cannot access the file because it is being used by another process.
Bonjour,
tout est dans le titre ! J'affiche une image en wpf via une grid dans une listbox, comme ceci :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,0,5,0" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="{Binding model3DThumbnailPath}" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="150" Width="150" />
<ListBoxItem Grid.Column="0" Grid.Row="1" Content="{Binding NameWithoutExtension}" VerticalAlignment="Bottom" HorizontalAlignment="Center" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate> |
L'image en question est générée plus loin dans mon code (en mvvm). Seulement au bout d'un moment je souhaiterais supprimer et remplacer cette image par une nouvelle sauf que j'obtiens cette erreur :
Citation:
The process cannot access the file because it is being used by another process.
Je présume qu'il s'agit de la Listbox-grid qui l'utilise pour l'afficher car je n'utilise cette image nulle part ailleurs.
Comment pourrais-je faire pour changer cette image alors que je n'y ai pas accès vu qu'elle est utilisée ?
Merci d'avance !