我添加了UserControl并介绍了插件,它的工作原理很棒。但是,当我尝试添加Material设计样式http://materialdesigninxaml.net/并将Resource添加到UserControl时,我在InitializeComponent()方法上收到了错误消息:
System.Windows.Markup.XamlParseException:'在'System.Windows.Markup.StaticResourceHolder'上提供值引发了异常。'NotImplementedException:该方法或操作未实现。
UserControl代码:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Makerbot.Print.Addin.Wpf"
x:Class="Makerbot.Print.Addin.Wpf.MyAddinControl"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
</Grid>
您能否指定可以在WPF应用程序之外使用ResourceDictionary和UserControl?
我将为Solid Works应用程序创建一个插件。 Solid Works的API允许我们引入ClassLibrary项目,并且为了实现UI,我们可以使用UserControl。我添加了UserControl并...