资源问题中的按钮 [英] Button in Resource problem

查看:60
本文介绍了资源问题中的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<UserControl x:Class="silver2.Control1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  mc:Ignorable="d"
  xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
  d:DesignHeight="300" d:DesignWidth="400">
  <UserControl.Resources>
    <ResourceDictionary>
      <Button Content="Button" x:Key="B1"/>
    </ResourceDictionary>
  </UserControl.Resources>
  
  <Grid x:Name="LayoutRoot" Background="White">
    <ContentControl x:Name="RootContent" Content="{StaticResource B1}"/>
  </Grid>
</UserControl>


上面的代码抛出'System.Windows.Markup.XamlParseException'。这里有什么问题?

The above code throws 'System.Windows.Markup.XamlParseException' . What is the problem here?

推荐答案

这个构建正常并且运行正常。

如果出现错误,那个错误必须来自其他地方。
This builds fine and runs fine.
If you get an error, that error must be coming from some other place.


这篇关于资源问题中的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆