Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Setter.Value the ContentProperty for Setter #84

Closed
thomaslevesque opened this issue Dec 5, 2018 · 5 comments · Fixed by #8534 or #9229
Closed

Make Setter.Value the ContentProperty for Setter #84

thomaslevesque opened this issue Dec 5, 2018 · 5 comments · Fixed by #8534 or #9229
Assignees
Labels
API suggestion Early API idea and discussion, it is NOT ready for implementation 🚧 work in progress Enhancement Requested Product code improvement that does NOT require public API changes/additions

Comments

@thomaslevesque
Copy link
Member

Currently, when you want to set the value of a setter to a complex object (e.g. control template), you have to specify the <Setter.Value> element:

<Style TargetType="Button">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                ...
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

But this element brings no value at all, it just adds noise. Making Value the ContentProperty for Setter would make the code a bit less verbose:

<Style TargetType="Button">
    <Setter Property="Template">
        <ControlTemplate TargetType="Button">
            ...
        </ControlTemplate>
    </Setter>
</Style>

(note: I tried to make this change, but I can't find the Setter class anywhere in the repo... nor can I find any of the controls. Where are they? Is there another repo?)

@rrelyea
Copy link

rrelyea commented Dec 5, 2018

Setter is in PresentationFramework.dll - that code is not yet in this repo. (System.Xaml to start).
Of course, if this change was wanted, you'd just add [ContentProperty("Value")] to the Setter class.

@thomaslevesque
Copy link
Member Author

Setter is in PresentationFramework.dll - that code is not yet in this repo.

I'll wait, then!

Of course, if this change was wanted, you'd just add [ContentProperty("Value")] to the Setter class.

Yes, that's what I thought. I've been ranting about this for years, so I'll be glad to be able to fix it 😉

@rladuca rladuca added the API suggestion Early API idea and discussion, it is NOT ready for implementation label Dec 5, 2018
@rladuca rladuca added this to the Future milestone Dec 5, 2018
@dotMorten
Copy link
Contributor

This is such an obvious and simple thing, I'm now wondering why I didn't think of that 😁 Awesome idea

@thomaslevesque
Copy link
Member Author

Is there anything still blocking this feature? PR #745 has been open for months, can it be merged now that .NET Core 3.0 (and 3.1) has been released?

@hez2010
Copy link

hez2010 commented May 20, 2024

Should this issue be reopened given that the PR has been reverted?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
API suggestion Early API idea and discussion, it is NOT ready for implementation 🚧 work in progress Enhancement Requested Product code improvement that does NOT require public API changes/additions
Projects
None yet
8 participants