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

ContentPresenter.Content is not inheriting its content #5

Open
samoteph opened this issue May 13, 2018 · 4 comments
Open

ContentPresenter.Content is not inheriting its content #5

samoteph opened this issue May 13, 2018 · 4 comments

Comments

@samoteph
Copy link

samoteph commented May 13, 2018

If I try to redefine the template of a button like this the contentpresenter doesn't work. But with ContentControl it's working !

<Style x:Name="EmptyButtonStyle" TargetType="Button">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <ContentControl Content="{TemplateBinding Content}"/>
                <!--<ContentPresenter></ContentPresenter>-->
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>
@jeromelaban
Copy link
Member

@samoteph it depends on thye platform. On iOS and Android, for now, the default style on Uno is using the native controls (e.g. BindableUIButton on iOS), which do not support advanced content. Also, defining an empty named or keyed style does not override the platform's default style, it merges its setters with the platform's style.

If you want to create your own button template, take the UWP generic.xaml (C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.14393.0\Generic\generic.xaml) default button template and customize from there, with a Template setter defined.

Let us know if this fixes your problem!

@samoteph
Copy link
Author

Thanks for the explanation about the button but in this case I don't understand why ContentControl works and ContentPresenter doesn't

@samoteph samoteph changed the title ContentPresenter is not apply ContentPresenter is not applied May 14, 2018
@jeromelaban jeromelaban changed the title ContentPresenter is not applied ContentPresenter.Content is not inheriting its content May 14, 2018
@jeromelaban
Copy link
Member

Make more sense with your updated sample. Yes, we do have one issue with the application of the content property of the ContentPresenter, you have to specify Content="{TemplateBinding Content}" on the ContentPresenter as the property is not yet inherited in Uno.

@samoteph
Copy link
Author

My bad ! A problem of git tag to see the complete sample :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants