I have a very simple set of styles that I'm using in a couple of different WPF applications. I have this style stored in a Xaml file in a common project, then added by merging into the Resources
in App.xaml
in each of the projects.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
<Style TargetType="dxe:ComboBoxEdit">
<Setter Property="AutoComplete" Value="True" />
<Setter Property="IncrementalFiltering" Value="True" />
<Setter Property="ImmediatePopup" Value="True" />
<Setter Property="IsTextEditable" Value="True" />
<Setter Property="ClearSelectionOnBackspace" Value="True" />
</Style>
<Style TargetType="dxe:ComboBoxEditSettings">
<Setter Property="AutoComplete" Value="True" />
<Setter Property="IncrementalFiltering" Value="True" />
<Setter Property="ImmediatePopup" Value="True" />
<Setter Property="IsTextEditable" Value="True" />
</Style>
</ResourceDictionary>
Unfortunately, something about this is causing a XamlParseException
regarding the TargetType
property, but only when not attached to the debugger. If I start the application in the debugger, everything is fine. If I "Start Without Debugging", I get this as App.xaml
is being loaded:
System.Windows.Markup.XamlParseException: 'Failed to create a 'TargetType' from the text 'dxe:ComboBoxEdit'.' Line number '5' and line position '12'. ---> System.Xaml.XamlParseException: Type reference cannot find type named '{http://schemas.devexpress.com/winfx/2008/xaml/editors}ComboBoxEdit'.
at MS.Internal.Xaml.Context.ObjectWriterContext.ServiceProvider_Resolve(String qName)
at MS.Internal.Xaml.ServiceProviderContext.System.Windows.Markup.IXamlTypeResolver.Resolve(String qName)
at System.Xaml.Replacements.TypeTypeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateObjectWithTypeConverter(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter`1 ts, Object value, XamlMember property)
at System.Xaml.XamlObjectWriter.Logic_CreateFromValue(ObjectWriterContext ctx, XamlValueConverter`1 typeConverter, Object value, XamlMember property, String targetName, IAddLineInfo lineInfo)
--- End of inner exception stack trace ---
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Shell.App.InitializeComponent() in c:\DevProjects\CoreApplication\Shell\App.xaml:line 1
at Shell.App.Main() in C:\DevProjects\CoreApplication\Shell\obj\x86\Debug\App.g.cs:line 0
If I comment out both Style
nodes, then everything works correctly. Any ideas?