uwp ContentControl TemplateBinding markup extension

0

The following XAML results in an error that makes no sense to me

<ToggleButton 
    Width="400" Height="400"
    Style="{StaticResource DieselToggleButton}"
    Margin="50, 0, 0, 0">

    <ContentControl Content="{TemplateBinding Content}"/>
</ToggleButton>

I get the following error:

Type 'TemplateBinding' used after '{' must be a Markup Extension. Error code 0x80004005.

Can somebody explain me what the problem is, and how to solve it?

c#
xaml
uwp
asked on Stack Overflow Dec 6, 2018 by bas

1 Answer

0

Use {Binding} or {x:Bind} in your case.

Attempting to use a TemplateBinding outside of a ControlTemplate definition in XAML will result in a parser error. https://docs.microsoft.com/en-us/windows/uwp/xaml-platform/templatebinding-markup-extension

answered on Stack Overflow Dec 7, 2018 by Canhua Li

User contributions licensed under CC BY-SA 3.0