wpfui
wpfui copied to clipboard
Changing SnackbarService presenter has no effect
Describe the bug
Good day,
as I've noticed calling SnackbarService.SetSnackbarPresenter with intention to change the snackbar presenter to another control has no effect if the SnackbarService was used at least once (the Show method was called) because it's storing the old host value in its private field (this._snackbar).
https://github.com/lepoco/wpfui/blob/776d9c79391a3d5d4505561dd38d5463148c55b3/src/Wpf.Ui/SnackbarService.cs#L25
My suggestion is to reset the this._snackbar when SetSnackbarPresenter is called, but I have no knowledge whether the already existing instance should be disposed in some specific way.
To Reproduce
- Use
SnackbarService.SetSnackbarPresenter - Call
SnackbarService.Show - Use
SnackbarService.SetSnackbarPresenteragain but provide another snackbar presenter - Call
SnackbarService.Show, observe that the old snackbar presenter is used
Expected behavior
SnackbarService must use the new presenter instead of the old one.
Screenshots
No response
OS version
Windows 11
.NET version
.NET Framework 4.8
WPF-UI NuGet version
4.0.2
Additional context
No response