Skip to content

Discussion: Add a new Style.Resources property to simplify Lightweight Styling #3939

@sonnemaf

Description

@sonnemaf

Discussion: Add a new Style.Resources property to simplify Lightweight Styling.

It would be nice we could add a Resources property to the Style class. It would allow you to define the Resources for this Style. This would simplify Lightweight Styling.

image

Setting the Resources in a Style.Setter isn't possible because it isn't a Dependency Property. See error message:

image

There is a workaround which I documented in my XAML Lightweight styling done right blog. It involves a custom Attached Property and a ResourceDictionaryCloner helper class (stolen from @rudyhuyn). @rudyhuyn has published a XamlPlus project with a similar (better) solution for this.

This workaround is a bit awkward and with a Style.Resources property it wouldn't be necessary. I hope you agree. Let's discuss this.

Related Links

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions