Snackbar no longer appears when setting Opacity via App.xaml style
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 9.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug
I am attempting to set the opacity of all my snackbars to 1 (fully opaque) in order to prevent display oddities that occur when displaying snackbars over other controls (pictured, perhaps another bug?)
When setting the opacity to 1 via App.xaml Application.Resources, snackbars no longer appear at all.
To Reproduce
- Create a SnackbarPresenter via Grid
<Grid>
<ContentPresenter/>
<SnackbarPresenter/>
</Grid>
- Set the Snackbar style in Application.Resources
<Application ...>
<Application.Resources>
<ResourceDictionary>
<Style TargetType="ui:Snackbar">
<Setter Property="Opacity" Value="0"/>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
- Set the Snackbar content via SnackbarService
Expected behavior
I would expect the opacity of the Snackbar to be 1 and the Snackbar to appear as usual.
Screenshots
No response
OS version
Windows 11
.NET version
Net8.0-Windows
WPF-UI NuGet version
3.0.4
Additional context
It appears ANY property set this way prevents a snackbar from appearing.
At the end of the day, what I really want to be able to do is have a clear way to prevent the snackbar from having any transparency. I believe by default it should be opaque.
I would be happy to add an example Snackbar usage to the documentation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the Grid, SnackbarPresenter, and Application.Resources example in App.xaml on .NET 8 Windows. Inspect how SnackbarService creates or displays Snackbar instances and how their styles are applied; done means setting a Snackbar property in application resources no longer prevents it from appearing, while the control remains opaque as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100