question

RogerSchlueter-7899 avatar image
0 Votes"
RogerSchlueter-7899 asked ·

Don't Understand Error in a Style

I am trying to write a style that includes a Template following the example on [this page][1]. Here is my Style.

 <Style
     TargetType="Border">
     <Setter Property="OverridesDefaultStyle" Value="True"/>
     <Setter Property="Template">
         <Setter.Value>
             <ControlTemplate
                 TargetType="Border">
                 <DockPanel x:Name="dpnl">
                     <Label x:Name="lblDay" />
                     <StackPanel />
                     <ContentPresenter />
                 </DockPanel>
             </ControlTemplate>
         </Setter.Value>
     </Setter>
 </Style>

The compile-time error I get is: The member "Template" is not recognized or is not accessible.

But that is exactly how the example shows it should be done.

What's wrong?

ETA: Here are the Tags I've tried: "Template", "Style", "Visual Studio" and "XAML" None are acceptable. Nothing else is appropriate so my tag is therefore useless.
[1]: https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.contentpresenter?view=netframework-4.7.1

not-supported
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers