2011-05-27 11 views
24

Bir ResourceDictionary benim ayarları ve stilleri tanımlayın: Başvurumu çalıştırdığınızdaHata: 'Bilinmeyen tür oluşturulamıyor' {clr-namespace: NameSpace.Properties} Ayarlar '.'

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:properties="clr-namespace:Kavand.UI.Properties"> 
    <ResourceDictionary.MergedDictionaries> 
     <ResourceDictionary> 
      <properties:Settings x:Key="settings" /> 
     </ResourceDictionary> 
    </ResourceDictionary.MergedDictionaries> 
    <Style x:Key="PopupMenu_StackPanel"> 
     <Setter Property="TextBlock.FontSize" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Size}" /> 
     <Setter Property="TextBlock.FontFamily" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Family}" /> 
     <Setter Property="TextBlock.FontWeight" Value="{Binding Source={StaticResource settings}, Path=Default.Font_Menu_Weight}" /> 
     <Style.Resources> 
      <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource KavandMenuItem}"> 
       <Style.Triggers> 
        <Trigger Property="IsChecked" Value="true"> 
         <Setter Property="IsEnabled" Value="false" /> 
        </Trigger> 
        <MultiTrigger> 
         <MultiTrigger.Conditions> 
          <Condition Property="IsChecked" Value="True" /> 
          <Condition Property="IsHighlighted" Value="True" /> 
         </MultiTrigger.Conditions> 
         <Setter Property="Foreground" Value="{DynamicResource K_Brush_Gray}" /> 
        </MultiTrigger> 
       </Style.Triggers> 
      </Style> 
     </Style.Resources> 
    </Style> 
</ResourceDictionary> 

, ben hata alıyorum: Ben dosyanın "Eylem İnşa" özelliğini ayarlayın etmişti

'Cannot create unknown type '{clr-namespace:Kavand.UI.Properties}Settings'.' Line number '6' and line position '14'.

+0

Bir derleme hatası mı, çalışma zamanı hatası mı? İlk üç ayarlayıcıyı kaldırmak uygulamanın uygulanmasına izin veriyor mu? – Adrian

+2

Bir çalışma zamanı hatası, hayır, sadece tanım içeren bir bölümü kaldırdığımda, uygulama derlenecek –

cevap

42

"Kaynak ". "Sayfa" olarak değiştirdiğimde sorun çözüldü.

33

senin "Eylem kurmak" özelliği için "Kaynak" tutun ve sadece bu satır değiştirin: xmlns: özellikleri = "clr-namespace: Kavand.UI.Properties" Bununla : xmlns: özellikleri =" clr-namespace: Kavand.UI.Properties; assembly = Kavand.UI "

+1

Bu doğru cevap, teşekkür ederim! –

İlgili konular