views:

292

answers:

0

Hi,

When I create a template for a combobox in generic.xaml, I get crashes with a combobox that contains Images. Even if the template is a exact copy of the original one.

When I remove the template from generic.xaml, everything works. Is this a known problem or am I doing something wrong?

I have tried the template found in System.Windows.dll (using reflector) and I tried to create a copy using blend en then removing x:Key.

any suggestions?

Thanks in advance.

I get the following message when clicking the combobox :

Sys.InvalidOperationException: ManagedRuntimeError error #4004 in control 'Xaml1': System.Windows.Markup.XamlParseException: [Line: 0 Position: 0] --- Inner Exception --- Value does not fall within the expected range. ---> System.ArgumentException: Value does not fall within the expected range. at MS.Internal.XcpImports.CheckHResult(UInt32 hr) at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper obj, DependencyProperty property, DependencyObject doh) at MS.Internal.XcpImports.SetValue(INativeCoreTypeWrapper doh, DependencyProperty property, Object obj) at System.Windows.DependencyObject.SetObjectValueToCore(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isSetByStyle, Boolean isSetByBuiltInStyle, PropertyInvalidationReason reason) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at System.Windows.Controls.ContentControl.set_Content(Object value) at System.Windows.Controls.ItemsControl.PrepareContainerForItemOverride(DependencyObject element, Object item) at System.Windows.Controls.Primitives.Selector.PrepareContainerForItemOverride(DependencyObject element, Object item) at System.Windows.Controls.ItemsControl.MS.Internal.Controls.IGeneratorHost.PrepareItemContainer(DependencyObject container, Object item) at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container) at System.Windows.Controls.ItemsControl.AddVisualChild(Int32 index, DependencyObject container, Boolean needPrepareContainer) at System.Windows.Controls.ItemsControl.AddContainers() at System.Windows.Controls.ItemsControl.RecreateVisualChildren(IntPtr unmanagedObj) --- End of inner exception stack trace --- at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData) at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name) at MS.Internal.XcpImports.FrameworkElement_ApplyTemplate(FrameworkElement frameworkElement) at System.Windows.FrameworkElement.ApplyTemplateInternal() at System.Windows.Controls.ScrollContentPresenter.HookupScrollingComponents() at System.Windows.Controls.ScrollContentPresenter.OnApplyTemplate() at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)