2016-03-30 20 views
0

İçinde 'Controls.xaml' adlı bir xaml dosyasına sahip 'Stil' adlı bir Sınıf Kitaplığım var.Kullanıcı denetimimi, ayrı bir sınıf kitaplığında tutulan bir kaynak sözlüğündeki stilleri kullanmak için nasıl alabilirim?

<UserControl.Resources> 
    <ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="pack://application:,,,/Styles;component/Controls.xaml"/> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</UserControl.Resources> 

: Sonra benim ana projede ve kullanıcı kontrolünde 'Styles' başvurulan

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
        xmlns:system="clr-namespace:System;assembly=mscorlib"> 

    <Style x:Key="DriveImageStyle" TargetType="{x:Type Image}"> 
     <Setter Property="Width" Value="30" /> 
     <Setter Property="Height" Value="30" /> 
     <Setter Property="Margin" Value="2" /> 
     <Setter Property="HorizontalAlignment" Value="Left" /> 
    </Style> 

    <Style x:Key="DriveLabelStyle" TargetType="{x:Type Label}"> 
     <Setter Property="VerticalAlignment" Value="Center" /> 
     <Setter Property="HorizontalAlignment" Value="Center" /> 
     <Setter Property="Foreground" Value="White" /> 
     <Setter Property="FontSize" Value="15" /> 
     <Setter Property="FontFamily" Value="Calibri Light" /> 
    </Style> 
</ResourceDictionary> 

i Kaynaklar bölümünde onu ekledi kullanmak istiyorum burada: Controls.xaml şöyle görünür Hata gösterilmez. İç hariç

Exception thrown: 'System.Windows.Markup.XamlParseException' in PresentationFramework.dll 

Additional information: 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.' Line number '13' and line position '18'. 

: i uygulamayı çalıştırmak Ancak ben hata mesajı alıyorum

{"Could not load file or assembly 'Styles, Culture=neutral' or one of its dependencies. The system cannot find the file specified.":"Styles, Culture=neutral"} 
yanlış nereye gidiyorum

kimse bana yardım edin, ben göremiyorum Could .

cevap

İlgili konular