我有一个用户控件这样的:WPF包括资源目录XamlParserException
<UserControl x:Class="LoginModule.LoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:controls="clr-namespace:UserControls;assembly=UserControls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<UserControl.Resources>
<ResourceDictionary Source="pack://application:,,,/UserControls;component/Styles.xaml" />
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="30" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200" />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<Label Grid.Row="1" Grid.Column="0" Name="labelLogin" VerticalAlignment="Center">Login:</Label>
<Label Grid.Row="2" Grid.Column="0" Name="labelPassword" VerticalAlignment="Center">Password:</Label>
<TextBox Grid.Row="1" Grid.Column="1" Name="textboxLogin" VerticalAlignment="Center"></TextBox>
<TextBox Grid.Row="2" Grid.Column="1" Name="textboxPassword" VerticalAlignment="Center"></TextBox>
<Button Grid.Row="3" Grid.ColumnSpan="2" Template="{StaticResource SilverButton}" Height="25" Width="200" Name="buttonLogin" Content="Log In" Click="buttonLogin_Click" />
</Grid>
</UserControl>
在设计模式一切正常(风格的作品),所有解决方案构建成功。但是,当我运行程序的调试,我得到XamlParserException在:
<ResourceDictionary Source="pack://application:,,,/UserControls;component/Styles.xaml" />
与像消息:无法加载用户控件OIR他的元素之一。无法加载文件。 我有参考UserControl.dll我不知道发生了什么事。
感谢您的快速帮助。 Kamilos
使用是用于解析任何XML文件的用户控件....贴上您的用户控件的代码,如果可能的 – 2011-01-21 23:05:28