2014-09-25 11 views
2

내 회계 시스템에 MahApps 스타일을 구현하려고합니다. 여기서 필요한 단계 인 MahApps을 따르겠습니다. 여기 정적 리소스를 확인할 수 없습니다.

내가 자원 appbar_cupcake 여기 해결할 수없는 오류에 붙어있는 코드가이기 때문에 당신이 아직 연결하지 않은 가정 코드

<Controls:MetroWindow x:Class="Hassab_Accounting_System.MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="350" Width="525"> 
<Grid> 

</Grid> 
<Controls:MetroWindow.RightWindowCommands> 
<Controls:WindowCommands> 
<Button Content="settings" /> 
<Button> 
    <StackPanel Orientation="Horizontal"> 
    <Rectangle Width="20" Height="20" 
       Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"> 
     <Rectangle.OpacityMask> 
     <VisualBrush Stretch="Fill" 
        Visual="{StaticResource appbar_cupcake}" /> 
     </Rectangle.OpacityMask> 
    </Rectangle> 
    <TextBlock Margin="4 0 0 0" 
       VerticalAlignment="Center" 
       Text="deploy cupcakes" /> 
    </StackPanel> 
    </Button> 
    </Controls:WindowCommands> 
    </Controls:MetroWindow.RightWindowCommands> 
    </Controls:MetroWindow> 
      ` 
    ![here is the error ][2] 

Exception

+0

당신은 또한 http://mahapps.com/guides/icons-and-resources 자원을 설치해야합니다 .html – Nitin

+0

@nit 이미 설치했습니다 :) 리소스 ... – Dexter90

+0

페이지에 표시된 리소스 요청을 포함 시켰습니까? – Nitin

답변

2

입니다 질문에 포함되지 않은 경우 파일 맨 위에있는 ResourceDictionary의 case.xxx 파일에 리소스 파일을 포함해야합니다.

뭔가 같은 :

<Window.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="/Resource/icon.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Window.Resources> 

또는처럼 App.xaml에

:

<Application.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="/Resource/icon.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Application.Resources> 
+0

실제로 나는 당신의 방법을 시도하지만 그것은 windows.resources가 접근 가능하지 않거나 인식 될 수 없다는 또 다른 오류를줍니다 ... – Dexter90

+0

당신이 쓰고있는 창입니까? 루트 요소 란 무엇입니까? 이면 로 바꿉니다. 동일한 작업이 , 등 – FishySwede

+0

실제로 사용하고 있습니다. 컨트롤 : MetroWindow.Resources도 똑같은 오류가 발생합니다. – Dexter90