2013-12-08 142 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