Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Why do I get the error the visualtree can be only set once?

$
0
0

I add a custom control in my project and in the axml I have this code:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Calendario"><Style TargetType="{x:Type local:CalendarioPersonalizado}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type local:CalendarioPersonalizado}"><Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"></Border><TextBlock></TextBlock></ControlTemplate></Setter.Value></Setter></Style></ResourceDictionary>

All the  code is generated by visual studio except the last textblock that I have added. But I get the error that the visualtree can be only set once.

I have the source code of another custom control and I have seen that is the same, in the same place and it works, so I don't understand why I get this error.

Thanks so much.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>