【问题标题】:WPF-Project System.Windows.Markup.XamlParseExceptionWPF 项目 System.Windows.Markup.XamlParseException
【发布时间】:2015-10-26 10:59:38
【问题描述】:

我希望有人可以帮助我。 我有一个 WPF 项目(它工作正常),我想使用它 在另一个。但我得到了 System.Windows.Markup.XamlParseException。

在:

<Expander IsExpanded="True"
                          Header="Symbols"
                          Margin="0,1,0,0"
                          Content="{StaticResource SymbolStencils}" />

我的 SymbolStencil 看起来像:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:s="clr-namespace:DiagramDesigner">

<s:Toolbox x:Key="SymbolStencils"
           DefaultItemSize="55,55">
    <ItemsControl.Items>
        <Button IsHitTestVisible="False">Button</Button>
        <ComboBox IsHitTestVisible="False" />
        <Label IsHitTestVisible="False" >Label</Label>
        <ListBox IsHitTestVisible="False" />
        <Rectangle IsHitTestVisible="False" />
        <TextBox IsHitTestVisible="False" >Text</TextBox>
        <TextBlock IsHitTestVisible="False" >Text</TextBlock>
        <RadioButton IsHitTestVisible="False" />
        <CheckBox IsHitTestVisible="False" />          
    </ItemsControl.Items>
</s:Toolbox>

【问题讨论】:

  • 您是否在存在 Expander 的 Xaml 文件中包含资源字典?

标签: wpf visual-studio xaml


【解决方案1】:
<Window x:Class="DiagramDesigner.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:DiagramDesigner"
    WindowStartupLocation="CenterScreen"
    Title="Diagram Designer Part 2"
    FontFamily="SegoeUI"
    Height="850"
    Width="1100">

这就是我在 XAML 文件中的想法

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-18
    • 2016-05-30
    • 1970-01-01
    相关资源
    最近更新 更多