2011-05-27 15 views
24

मैं एक ResourceDictionary में अपनी सेटिंग्स और शैलियों को परिभाषित:त्रुटि: 'अज्ञात प्रकार नहीं बना सकता' {clr-namespace: nameSpace.Properties} सेटिंग्स '।'

<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> 

जब मैं अपने आवेदन चलाने के लिए, मैं त्रुटि मिलती है:

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

+0

क्या यह एक संकलित त्रुटि या रनटाइम त्रुटि है? क्या पहले तीन सेटर्स को हटाने से एप्लिकेशन को चलाने की अनुमति मिलती है? – Adrian

+2

यह रनटाइम त्रुटि है, नहीं, बस जब मैं परिभाषा वाले अनुभाग को हटाता हूं, तो एप्लीकेशन संकलित किया जाएगा –

उत्तर

42

मैं फ़ाइल के "कार्रवाई बनाएँ" संपत्ति के लिए निर्धारित किया था "संसाधन "। जब मैंने इसे "पृष्ठ" में बदल दिया तो समस्या हल हो गई।

33

अपना "कार्रवाई बनाएँ" संपत्ति को "संसाधन" रखें और सिर्फ इस पंक्ति को बदलने: xmlns: गुण = "clr-नाम स्थान: Kavand.UI.Properties" इस के साथ : xmlns: गुण = " clr-namespace: Kavand.UI.Properties; असेंबली = Kavand.UI "

+1

यह सही जवाब है, धन्यवाद! –

संबंधित मुद्दे