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

Open
thomaslevesque opened this Issue Dec 5, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@thomaslevesque

thomaslevesque commented Dec 5, 2018

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

This comment has been minimized.

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

This comment has been minimized.

thomaslevesque commented Dec 5, 2018

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 this to the Future milestone Dec 5, 2018

@dotMorten

This comment has been minimized.

Collaborator

dotMorten commented Dec 5, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment