Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xaml Silverlight AG_E_Unknown_错误UserControl Apps.xml模板_Xaml_Templates_Silverlight_User Controls - Fatal编程技术网

Xaml Silverlight AG_E_Unknown_错误UserControl Apps.xml模板

Xaml Silverlight AG_E_Unknown_错误UserControl Apps.xml模板,xaml,templates,silverlight,user-controls,Xaml,Templates,Silverlight,User Controls,我创建了一个简单的用户控件,即使应用程序运行正常,也可以将模板应用到 我在这里定义控件模板 App.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ResourcesCountDown.App

我创建了一个简单的用户控件,即使应用程序运行正常,也可以将模板应用到

我在这里定义控件模板

App.xaml

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="ResourcesCountDown.App"
             >
    <Application.Resources>

        <ControlTemplate x:Key="myWindowTemplate">
            <Grid x:Name="myGrid" Background="Black" Width="50" Height="50">
                <ContentPresenter Name="Content"></ContentPresenter>
            </Grid>
        </ControlTemplate>

    </Application.Resources>
</Application>

我想您的
上需要一个TargetType=“Grid”:

<ControlTemplate x:Key="myWindowTemplate TargetType="Grid">

我想您的
上需要一个TargetType=“Grid”:

<ControlTemplate x:Key="myWindowTemplate TargetType="Grid">

实际上,根据您发布的代码,您的TargetType应该是Button,因为您正在将模板应用于Button。

实际上,根据您发布的代码,您的TargetType应该是Button,因为您正在将模板应用于Button

<ControlTemplate x:Key="myWindowTemplate TargetType="Grid">