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

问题描述

<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?

推荐答案


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

09-02 23:14