设计器显示:无效的Xaml

本文关键字:无效 Xaml 显示 | 更新日期: 2023-09-27 18:23:42

你好,我有一些例子,部署的代码工作时没有任何错误,但设计者抱怨。

我搜索这种类型的错误是指项目名称中有"空格"或phone.controls的旧版本。这对我来说都不是问题。因此,我认为这可能是模板结构的变化?我有三个例子都给出了错误:

示例1

<ListBox Canvas.ZIndex="1001" Grid.Row="0" x:Name="ColorPickerListBox" ItemsSource="{Binding ColorList}">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Button BorderBrush="Transparent" BorderThickness="0" Command="{Binding DataContext.ChangeColourCommand, ElementName=ColorPickerListBox}" CommandParameter="{Binding}">
                        <Button.Template>
                            <ControlTemplate>
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition Width="50"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="50"/>
                                        <RowDefinition Height="10"/>
                                    </Grid.RowDefinitions>
                                    <Rectangle Grid.Column="0" Fill="{Binding color}">
                                    </Rectangle>
                                    <TextBlock Text="{Binding name}" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" Grid.Column="1" FontSize="10"/>
                                </Grid>
                            </ControlTemplate>
                        </Button.Template>
                    </Button>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

示例2

<View:CanvasItemsControl ItemsSource="{Binding DecorationOnShield}">
            <View:CanvasItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Canvas/>
                </ItemsPanelTemplate>
            </View:CanvasItemsControl.ItemsPanel>
        </View:CanvasItemsControl>

示例3

<ControlTemplate TargetType="Button">
                    <Grid Background="Transparent">
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal"/>
                                <VisualState x:Name="MouseOver"/>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimation Duration="0" To="#FFFFE5CD" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Path_6" d:IsOptimized="True"/>
                                        <ColorAnimation Duration="0" To="#FFFFE5CD" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="Rectangle_7" d:IsOptimized="True"/>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled"/>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Viewbox Margin="-10,0" RenderTransformOrigin="0.5,0.5">
                            <Viewbox.RenderTransform>
                                <CompositeTransform ScaleX="-1"/>
                            </Viewbox.RenderTransform>
                            <Grid Height="60" Width="109">
                                <Viewbox x:Name="Group" Width="108.952" Height="60.3575">
                                    <Viewbox Height="49" Width="103">
                                        <Grid Height="58.5920524596841" Width="114.358690261841">
                                            <Viewbox x:Name="Group1" Width="107.672" Height="16.0729" Margin="0,43,6,0">
                                                <Canvas Width="107.672" Height="16.0729">
                                                    <Rectangle x:Name="Rectangle1" Width="83.1734" Height="14.4729" Canvas.Left="15.6519" Canvas.Top="0.799988" Stretch="Fill" Fill="#FF733800"/>
                                                    <Path x:Name="Path1" Width="36.1823" Height="4.64556" Canvas.Left="14.9854" Canvas.Top="6.83045" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.3054,8.42395C 18.6213,8.42395 25.7329,8.47461 28.5751,8.03607C 31.4174,7.59753 51.3131,6.0625 50.8394,8.47473C 50.3657,10.8868 45.1549,11.3254 38.523,11.1061C 31.8911,10.8868 30.6373,10.33 15.4787,10.33"/>
                                                    <Path x:Name="Path_15" Width="39.3557" Height="7.28494" Canvas.Left="15.1587" Canvas.Top="5.56275" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.4787,7.21094C 22.1106,7.21094 29.0489,7.15894 33.7859,6.28186C 38.523,5.40466 55.1028,5.84326 54.1553,8.91327C 53.2079,11.9833 40.8915,12.8604 31.4174,12.4218C 21.9432,11.9833 23.058,11.4968 15.4787,11.7162"/>
                                                    <Path x:Name="Path_18" Width="42.4594" Height="9.32969" Canvas.Left="15.3319" Canvas.Top="4.50856" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.6519,5.47815C 23.705,5.25891 40.4178,4.52753 46.1023,4.96606C 51.7868,5.40466 57.4713,6.93964 57.4713,8.69397C 57.4713,10.4482 48.4709,13.5182 43.2601,13.5182C 38.0492,13.5183 18.9679,12.7558 15.6519,12.7559"/>
                                                    <Path x:Name="Path_20" Width="6.85588" Height="2.21011" Canvas.Left="39.0928" Canvas.Top="7.91791" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Fill="#FF5B2D00" Data="F1 M 45.6287,9.57123C 45.6288,9.57123 44.3729,8.36206 43.7438,8.25555C 43.1148,8.14893 38.8722,8.53601 39.4705,9.13269C 40.0687,9.72943 45.598,10.0614 45.6287,9.57123 Z "/>
                                                    <Path x:Name="Path_21" Width="6.85587" Height="2.2101" Canvas.Left="63.2515" Canvas.Top="7.03786" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Fill="#FF5B2D00" Data="F1 M 69.7874,8.69116C 69.7874,8.69116 68.5316,7.48206 67.9025,7.37549C 67.2735,7.26892 63.0309,7.65594 63.6292,8.25262C 64.2274,8.84937 69.7567,9.18134 69.7874,8.69116 Z "/>
                                                    <Path x:Name="Path_22" Width="14.1696" Height="4.74651" Canvas.Left="59.8778" Canvas.Top="5.80243" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF5B2D00" Data="F1 M 65.998,10.2289C 64.5,10.229 59.3661,8.91327 60.3135,8.03607C 61.2609,7.15894 67.4192,5.62396 68.8403,6.28186C 70.2614,6.9397 74.5823,7.4801 73.5773,8.25537C 72.1562,9.35181 67.4191,10.229 65.998,10.2289 Z "/>
                                                    <Path x:Name="Path_23" Width="20.0949" Height="6.93487" Canvas.Left="58.0987" Canvas.Top="4.49127" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 59.3661,5.62396C 61.0383,5.10791 65.0507,4.52753 69.314,4.96606C 73.5773,5.40466 78.3145,7.15894 77.8407,7.81683C 77.367,8.47473 72.1563,11.1061 69.7877,11.1061C 67.4191,11.1061 59.3661,10.4482 58.8924,9.79041C 58.4187,9.13251 57.945,6.06262 59.3661,5.62396 Z "/>
                                                    <Path x:Name="Path_24" Width="83.9867" Height="4.72045" Canvas.Left="15.1587" Canvas.Top="3.33039" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.4787,4.4386C 18.3209,4 24.3118,3.65033 32.8385,3.65039C 41.3652,3.65039 53.6816,4.52753 55.1028,4.96606C 56.5239,5.40466 59.3661,4.52753 60.7872,4.30823C 62.2084,4.08899 72.1562,3.86963 77.367,5.40466C 82.5778,6.9397 79.2761,7.22693 93.9468,7.59753L 98.8254,7.73083"/>
                                                    <Path x:Name="Path_25" Width="83.4669" Height="6.91535" Canvas.Left="15.5052" Canvas.Top="8.11652" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.8252,14.3154C 21.036,14.5347 49.4183,15.4918 53.6816,13.299C 57.945,11.1061 59.3661,11.5446 63.1558,11.9833C 66.9454,12.4218 79.7356,10.4482 83.0515,9.13251C 86.3674,7.81689 98.6521,8.77045 98.6521,8.77045"/>
                                                    <Path x:Name="Path_26" Width="83.6401" Height="4.56681" Canvas.Left="15.1587" Canvas.Top="2.04611" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.4787,3.05237C 25.9002,2.61377 49.892,1.67676 54.1553,3.65039C 58.4187,5.62396 58.4187,1.01898 70.7351,2.77319C 83.0515,4.52759 82.5778,6.28186 88.736,6.28186C 94.8942,6.28192 98.4788,6.34448 98.4788,6.17133"/>
                                                    <Path x:Name="Path_27" Width="44.3626" Height="5.48682" Canvas.Left="54.7828" Canvas.Top="9.44786" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 55.1028,14.6147C 55.1028,14.6147 57.4713,12.4218 60.7873,12.8604C 64.1032,13.299 83.0515,10.8868 85.8937,10.229C 88.736,9.57123 98.8254,9.81018 98.8254,9.81018"/>
                                                    <Path x:Name="Path_28" Width="15.458" Height="2.02624" Canvas.Left="15.3319" Canvas.Top="0.47968" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.6519,2.18591C 18.4942,2.18591 30.47,0.799683 30.47,0.799683"/>
                                                    <Path x:Name="Path_29" Width="23.0458" Height="5.04474" Canvas.Left="76.0996" Canvas.Top="0.47968" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 76.4196,0.799683C 76.4196,0.799683 85.8938,4.74677 88.736,4.74677C 91.5782,4.74683 93.1409,5.61615 98.8254,4.95837"/>
                                                    <Path x:Name="Path_30" Width="10.5879" Height="3.27141" Canvas.Left="88.416" Canvas.Top="0.47968" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB25700" Data="F1 M 88.736,0.799683C 88.736,0.799683 91.1046,3.21179 98.6839,3.43109"/>
                                                    <Path x:Name="Path_31" Width="37.257" Height="4.25" Canvas.Left="61.8884" Canvas.Top="11.1232" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 62.2084,15.0532C 62.2084,15.0532 71.2088,13.9568 76.4196,13.0797C 81.6304,12.2026 93.1409,11.1044 98.8254,11.543"/>
                                                    <Path x:Name="Path_32" Width="13.0979" Height="2.68285" Canvas.Left="86.0475" Canvas.Top="13.129" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 86.3675,15.4918C 86.3675,15.4918 90.2987,13.4489 98.8254,13.449"/>
                                                    <Rectangle x:Name="Rectangle_1" Width="84.9467" Height="16.0729" Canvas.Left="14.6786" Canvas.Top="-1.01924e-005" Stretch="Fill" StrokeThickness="1.6" StrokeLineJoin="Round" Stroke="#FF000000"/>
                                                </Canvas>
                                            </Viewbox>
                                            <Viewbox x:Name="Group_16" Width="107.672" Height="16.0728" Margin="0,28,6,15">
                                                <Canvas Width="107.672" Height="16.0728">
                                                    <Rectangle x:Name="Rectangle_17" Width="83.1734" Height="14.4729" Canvas.Left="15.6519" Canvas.Top="0.799927" Stretch="Fill" Fill="#FF733800"/>
                                                    <Path x:Name="Path_33" Width="36.1823" Height="4.64552" Canvas.Left="14.9854" Canvas.Top="6.83047" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.3054,8.42389C 18.6213,8.42389 25.7329,8.47461 28.5751,8.03613C 31.4174,7.59753 51.3131,6.06256 50.8394,8.47467C 50.3657,10.8868 45.1549,11.3254 38.523,11.1061C 31.8911,10.8868 30.6373,10.33 15.4787,10.33"/>
                                                    <Path x:Name="Path_34" Width="39.3557" Height="7.28502" Canvas.Left="15.1587" Canvas.Top="5.56273" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.4787,7.211C 22.1106,7.211 29.0489,7.159 33.7859,6.2818C 38.523,5.40466 55.1028,5.84326 54.1553,8.91321C 53.2079,11.9833 40.8915,12.8604 31.4174,12.4219C 21.9432,11.9833 23.058,11.4969 15.4787,11.7162"/>
                                                    <Path x:Name="Path_35" Width="40.9735" Height="9.32975" Canvas.Left="15.3319" Canvas.Top="4.50856" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.6519,5.47815C 23.705,5.25885 40.4178,4.52747 46.1023,4.96613C 51.7868,5.40466 55.9854,6.97742 55.9854,8.73175C 55.9854,10.4861 48.4709,13.5182 43.2601,13.5183C 38.0492,13.5183 18.9679,12.7559 15.6519,12.7559"/>
                                                    <Path x:Name="Path_36" Width="6.85588" Height="2.2101" Canvas.Left="39.0929" Canvas.Top="7.91786" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Fill="#FF5B2D00" Data="F1 M 45.6288,9.57117C 45.6288,9.57117 44.373,8.36206 43.7439,8.25549C 43.1148,8.14893 38.8722,8.53595 39.4706,9.13263C 40.0688,9.72937 45.5981,10.0613 45.6288,9.57117 Z "/>
                                                    <Path x:Name="Path_37" Width="14.1637" Height="2.85962" Canvas.Left="59.8821" Canvas.Top="6.54972" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF5B2D00" Data="F1 M 66.2254,9.05176C 64.7274,9.05182 59.3661,8.91321 60.3135,8.03613C 61.2609,7.159 67.3643,6.47388 68.7854,7.13171C 70.2065,7.78961 74.5823,7.4801 73.5773,8.25543C 72.1562,9.35181 67.6465,9.05182 66.2254,9.05176 Z "/>
                                                    <Path x:Name="Path_38" Width="19.7231" Height="6.12216" Canvas.Left="58.4712" Canvas.Top="5.30393" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 61.1054,6.17175C 62.7776,5.65576 65.162,5.41321 69.4254,5.85181C 73.6887,6.29034 78.3145,7.15894 77.8407,7.81677C 77.367,8.47473 72.1563,11.1061 69.7877,11.1061C 67.4191,11.1061 59.3661,10.4482 58.8924,9.79041C 58.4187,9.13257 59.6843,6.61041 61.1054,6.17175 Z "/>
                                                    <Path x:Name="Path_39" Width="83.9867" Height="4.72039" Canvas.Left="15.1587" Canvas.Top="3.33039" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.4787,4.43854C 18.3209,4 24.3118,3.65039 32.8385,3.65039C 41.3652,3.65039 53.6816,4.52747 55.1028,4.96613C 56.5239,5.40466 59.3661,4.52747 60.7872,4.30823C 62.2084,4.08899 72.1562,3.86963 77.367,5.40466C 82.5778,6.93976 79.2761,7.22693 93.9468,7.59753L 98.8254,7.73077"/>
                                                    <Path x:Name="Path_40" Width="83.4669" Height="6.91532" Canvas.Left="15.5052" Canvas.Top="8.11655" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.8252,14.3154C 21.036,14.5347 49.4183,15.4918 53.6816,13.299C 57.945,11.1061 59.3661,11.5447 63.1558,11.9833C 66.9454,12.4219 79.7356,10.4482 83.0515,9.13257C 86.3674,7.81689 98.6521,8.77051 98.6521,8.77051"/>
                                                    <Path x:Name="Path_41" Width="83.6401" Height="4.56676" Canvas.Left="15.1587" Canvas.Top="2.04613" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 15.4787,3.05231C 25.9002,2.61377 49.892,1.67682 54.1553,3.65039C 58.4187,5.62402 58.4187,1.01892 70.7351,2.77325C 83.0515,4.52759 82.5778,6.2818 88.736,6.2818C 94.8942,6.28186 98.4788,6.34454 98.4788,6.17126"/>
                                                    <Path x:Name="Path_42" Width="44.3626" Height="5.48682" Canvas.Left="54.7828" Canvas.Top="9.44781" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 55.1028,14.6146C 55.1028,14.6146 57.4713,12.4218 60.7873,12.8604C 64.1032,13.299 83.0515,10.8868 85.8937,10.229C 88.736,9.57117 98.8254,9.81012 98.8254,9.81012"/>
                                                    <Path x:Name="Path_43" Width="15.458" Height="2.02624" Canvas.Left="15.3319" Canvas.Top="0.47968" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 15.6519,2.18591C 18.4942,2.18591 30.47,0.799683 30.47,0.799683"/>
                                                    <Path x:Name="Path_44" Width="23.0458" Height="5.04483" Canvas.Left="76.0996" Canvas.Top="0.479619" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 76.4196,0.799622C 76.4196,0.799622 85.8938,4.74683 88.736,4.74683C 91.5782,4.74683 93.1409,5.61621 98.8254,4.95837"/>
                                                    <Path x:Name="Path_45" Width="10.5879" Height="3.27141" Canvas.Left="88.416" Canvas.Top="0.479619" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB25700" Data="F1 M 88.736,0.799622C 88.736,0.799622 91.1046,3.21179 98.6839,3.43103"/>
                                                    <Path x:Name="Path_46" Width="37.257" Height="4.25009" Canvas.Left="61.8884" Canvas.Top="11.1232" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 62.2084,15.0533C 62.2084,15.0533 71.2088,13.9568 76.4196,13.0797C 81.6304,12.2025 93.1409,11.1043 98.8254,11.543"/>
                                                    <Path x:Name="Path_47" Width="13.0979" Height="2.68285" Canvas.Left="86.0475" Canvas.Top="13.129" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 86.3675,15.4918C 86.3675,15.4918 90.2987,13.449 98.8254,13.449"/>
                                                    <Rectangle x:Name="Rectangle_33" Width="84.9467" Height="16.0729" Canvas.Left="14.6786" Canvas.Top="-7.12276e-005" Stretch="Fill" StrokeThickness="1.6" StrokeLineJoin="Round" Stroke="#FF000000"/>
                                                </Canvas>
                                            </Viewbox>
                                            <Viewbox x:Name="Group_34" Width="107.672" Height="16.0728" Margin="6,15,0,28">
                                                <Canvas Width="107.672" Height="16.0728">
                                                    <Rectangle x:Name="Rectangle_35" Width="83.1734" Height="14.4729" Canvas.Left="8.84671" Canvas.Top="0.799988" Stretch="Fill" Fill="#FF733800"/>
                                                    <Path x:Name="Path_48" Width="36.1823" Height="4.64557" Canvas.Left="56.5044" Canvas.Top="6.83046" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 92.3667,8.42389C 89.0508,8.42389 81.9392,8.47461 79.097,8.03613C 76.2547,7.5976 56.359,6.0625 56.8327,8.47467C 57.3064,10.8868 62.5172,11.3254 69.1491,11.1061C 75.781,10.8868 77.0348,10.33 92.1934,10.33"/>
                                                    <Path x:Name="Path_49" Width="39.3557" Height="7.285" Canvas.Left="53.1578" Canvas.Top="5.56276" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 92.1934,7.211C 85.5615,7.211 78.6232,7.159 73.8862,6.2818C 69.1491,5.40472 52.5693,5.84326 53.5168,8.91327C 54.4642,11.9833 66.7806,12.8604 76.2547,12.4219C 85.7289,11.9833 84.6141,11.4969 92.1934,11.7162"/>
                                                    <Path x:Name="Path_50" Width="42.4594" Height="9.32973" Canvas.Left="49.8808" Canvas.Top="4.50859" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 92.0202,5.47821C 83.9671,5.25885 67.2543,4.52753 61.5698,4.96613C 55.8853,5.40472 50.2008,6.93964 50.2008,8.69403C 50.2008,10.4482 59.2013,13.5182 64.4121,13.5183C 69.6229,13.5183 88.7042,12.7559 92.0202,12.7559"/>
                                                    <Path x:Name="Path_51" Width="6.85587" Height="2.21015" Canvas.Left="61.7233" Canvas.Top="7.91792" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Fill="#FF5B2D00" Data="F1 M 62.0433,9.57129C 62.0433,9.57129 63.2991,8.36212 63.9282,8.25555C 64.5573,8.14899 68.7999,8.53595 68.2016,9.13275C 67.6033,9.72943 62.0741,10.0615 62.0433,9.57129 Z "/>
                                                    <Path x:Name="Path_52" Width="14.1696" Height="4.7466" Canvas.Left="33.6248" Canvas.Top="5.8024" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF5B2D00" Data="F1 M 41.6741,10.229C 43.1721,10.229 48.306,8.91327 47.3586,8.03613C 46.4112,7.159 40.253,5.62396 38.8318,6.2818C 37.4107,6.9397 33.0899,7.48016 34.0948,8.25543C 35.5159,9.35181 40.253,10.229 41.6741,10.229 Z "/>
                                                    <Path x:Name="Path_53" Width="20.0949" Height="6.93487" Canvas.Left="29.4785" Canvas.Top="4.49127" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 48.306,5.62396C 46.6338,5.10791 42.6215,4.52753 38.3581,4.96606C 34.0948,5.40472 29.3577,7.15894 29.8314,7.81683C 30.3051,8.47479 35.5159,11.1061 37.8844,11.1061C 40.253,11.1061 48.306,10.4482 48.7797,9.79047C 49.2534,9.13257 49.7271,6.06256 48.306,5.62396 Z "/>
                                                    <Path x:Name="Path_54" Width="83.9867" Height="4.72039" Canvas.Left="8.52672" Canvas.Top="3.33039" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 92.1934,4.43854C 89.3512,4 83.3603,3.65039 74.8336,3.65039C 66.3069,3.65039 53.9905,4.52753 52.5694,4.96613C 51.1482,5.40472 48.306,4.52753 46.8849,4.30829C 45.4638,4.08893 35.5159,3.86963 30.3051,5.40472C 25.0944,6.93976 28.3961,7.22699 13.7253,7.5976L 8.84673,7.73077"/>
                                                    <Path x:Name="Path_55" Width="83.4669" Height="6.91535" Canvas.Left="8.70001" Canvas.Top="8.11655" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 91.8469,14.3154C 86.6361,14.5347 58.2538,15.4919 53.9905,13.299C 49.7271,11.1061 48.306,11.5447 44.5163,11.9833C 40.7267,12.4219 27.9365,10.4482 24.6206,9.13257C 21.3047,7.81689 9.02001,8.77051 9.02001,8.77051"/>
                                                    <Path x:Name="Path_56" Width="83.6401" Height="4.56678" Canvas.Left="8.8733" Canvas.Top="2.04615" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 92.1934,3.05231C 81.7719,2.61377 57.7801,1.67676 53.5168,3.65039C 49.2534,5.62396 49.2534,1.01898 36.937,2.77325C 24.6206,4.52759 25.0943,6.2818 18.9361,6.2818C 12.7779,6.28192 9.19327,6.34454 9.1933,6.17133"/>
                                                    <Path x:Name="Path_57" Width="44.3626" Height="5.48686" Canvas.Left="8.52672" Canvas.Top="9.44783" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 52.5693,14.6147C 52.5693,14.6147 50.2008,12.4218 46.8849,12.8604C 43.5689,13.299 24.6206,10.8868 21.7784,10.229C 18.9361,9.57123 8.84673,9.81012 8.84673,9.81012"/>
                                                    <Path x:Name="Path_58" Width="15.458" Height="2.02624" Canvas.Left="76.8822" Canvas.Top="0.479741" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 92.0202,2.18597C 89.1779,2.18597 77.2022,0.799744 77.2022,0.799744"/>
                                                    <Path x:Name="Path_59" Width="23.0458" Height="5.0448" Canvas.Left="8.52674" Canvas.Top="0.479619" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 31.2525,0.799622C 31.2525,0.799622 21.7783,4.74683 18.9361,4.74683C 16.0939,4.74683 14.5312,5.61621 8.84674,4.95831"/>
                                                    <Path x:Name="Path_60" Width="10.5879" Height="3.27147" Canvas.Left="8.66824" Canvas.Top="0.479619" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB25700" Data="F1 M 18.9361,0.799622C 18.9361,0.799622 16.5676,3.21173 8.98824,3.43109"/>
                                                    <Path x:Name="Path_61" Width="37.257" Height="4.25008" Canvas.Left="8.52672" Canvas.Top="11.1232" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FF4A2500" Data="F1 M 45.4637,15.0533C 45.4637,15.0533 36.4633,13.9568 31.2525,13.0797C 26.0417,12.2026 14.5312,11.1043 8.84673,11.543"/>
                                                    <Path x:Name="Path_62" Width="13.0979" Height="2.68291" Canvas.Left="8.52674" Canvas.Top="13.129" Stretch="Fill" StrokeThickness="0.640004" StrokeLineJoin="Round" Stroke="#FFB65900" Data="F1 M 21.3046,15.4919C 21.3046,15.4919 17.3735,13.449 8.84674,13.449"/>
                                                    <Rectangle x:Name="Rectangle_51" Width="84.9467" Height="16.0729" Canvas.Left="8.04671" Canvas.Top="-1.01924e-005" Stretch="Fill" StrokeThickness="1.6" StrokeLineJoin="Round" Stroke="#FF000000"/>
                                                </Canvas>
                                            </Viewbox>
                                        </Grid>
                                    </Viewbox>
                            </Grid>
                        </Viewbox>
                    </Grid>
                </ControlTemplate>

另一个项目

在其他项目中使用上述代码并不总是会出现相同的错误,这增加了错误的奇妙性。

尝试创建一个全新的项目,并且只重用代码,但无效的xaml仍然存在。但仍然编译和部署良好:/

初始解决方案

我们使用了NuGet的一个关于blend.expression.sdk的包,这个包引入了错误。但它是必要的,因为其中一台计算机在安装blend或visual studio时没有收到参考资料。

设计器显示:无效的Xaml

在我使用Visual Studio 2013/15的经验中,XAML设计器似乎是随机的,会抛出"无效标记"消息,或者根本不会加载——尽管应用程序编译和运行非常好。

重新启动Visual Studio一直为我解决了这个问题。

如果设计器在重新启动后不显示预览。。。我建议注释掉标记中的元素,直到成功为止。或者,创建一个新的空白页面,正确预览并一次添加一个元素,直到它1)与您的一个示例匹配或2)突然失败(在这种情况下,您发现了有问题的元素)。