2013-12-08 105 views
0

我收到以下错误,当我运行我的程序:资源“XX”无法解析

警告资源“bellRingersStyle”无法得到解决。

这出现在最后两行{StaticResource bellRingersStyle}

<Window x:Class="BellRingers.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     Title="Middleshire Bell Ringers Association – Members" Height="350" Width="525"> 
    <Window.Resources> 
     <Style x:Key="bellRingerStyle" TargetType="Control"> 
      <Setter Property="Button.Background" Value="Gray"/> 
      <Setter Property="Button.Foreground" Value="Gray"/> 
      <Setter Property="Button.FontFamily" Value="Comic Sans MS"/> 
      <Style.Triggers> 
       <Trigger Property="IsMouseOver" Value="True"> 
        <Setter Property="Background" Value="Blue"/> 
       </Trigger> 
      </Style.Triggers> 
     </Style> 
    </Window.Resources> 
    <Grid> 
     <Button Style="{StaticResource bellRingerStyle}" Panel.ZIndex="1" Content="Button" Height="23" HorizontalAlignment="Left" Margin="400,131,0,0" Name="button1" VerticalAlignment="Top" Width="75" > 
      </Button> 
     <Button Style="{StaticResource bellRingersStyle}" Panel.ZIndex="1" Content="Button" Height="23" Margin="0,0,0,0" Name="button2" Width="75" /> 
      <Image Panel.ZIndex="0" Margin="0,0,0,0" Name="image1" > 
      <Image.Source> 
       <BitmapImage UriSource="bell.gif" /> 
      </Image.Source> 
     </Image> 
     <TextBox Style="{StaticResource bellRingersStyle}" Height="23" HorizontalAlignment="Left" Margin="206,271,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" /> 
    </Grid> 
</Window> 
+0

什么是资源'xx'? –

+0

我改变了它,忘了补充说明。抱歉。 – user2856358

回答

2

您有一个错字。你将它定义为bellRingerStyle,但引用bellRingersStyle。

+0

yup ...复数与单数。 – DRapp