CheckComboBox 无法同时设置 DisplayMemberPath 和 ItemTemplate
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
Research direction
Start by reproducing the issue with a CheckComboBox that sets both DisplayMemberPath and ItemTemplate, then compare it with the same control inside a DataGridTemplateColumn CellTemplate. Trace the control's template-property handling and verify that the standalone case no longer throws while preserving the working templated-column behavior.
Written by the indexing model from the issue text.
Description
Describe the bug
CheckComboBox 无法同时设置 DisplayMemberPath 和 ItemTemplate,设计时错误,运行时也错误,但是如果这个 CheckComboBox 作为 DataGridTemplateColumn 的 CellTemplate,那么又没问题。
Timestamp: 2026/3/15 星期日 上午 11:40:59
OSVersion: Microsoft Windows NT 10.0.26200.0
ClrVersion: 10.0.3
ThreadName: N/A(2)
----------------------------------------
Handler: DispatcherUnhandledException
----------------------------------------
Type: System.Windows.Markup.XamlParseException
Source: PresentationFramework
Message: “设置属性“System.Windows.Controls.ItemsControl.ItemTemplate”时引发了异常。”,行号为“246”,行位置为“43”。
TargetSite: Void RewrapException(System.Exception, System.Xaml.IXamlLineInfo, System.Uri)
StackTrace:
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 System.Reflection.MethodBaseInvoker.InvokeWithFewArgs(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitDisposeCache(ServiceCallSite transientCallSite, RuntimeResolverContext context)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(ServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass2_0.<RealizeService>b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier serviceIdentifier, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at CommunityToolkit.Mvvm.Input.RelayCommand.Execute(Object parameter)
at System.Windows.Controls.MenuItem.InvokeClickAfterRender(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
HResult: -2146233087
HelpLink: null
--- Inner Exception (Level 1) ---
Type: System.InvalidOperationException
Source: PresentationFramework
Message: 无法同时设置 DisplayMemberPath 和 ItemTemplate。
TargetSite: Void CheckTemplateSource()
StackTrace:
at System.Windows.Controls.ItemsControl.CheckTemplateSource()
at System.Windows.Controls.ItemsControl.OnItemTemplateChanged(DataTemplate oldItemTemplate, DataTemplate newItemTemplate)
at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetValue(Object inst, XamlMember property, Object value)
HResult: -2146233079
HelpLink: null
InnerException: null
Steps to reproduce the bug
- 添加 CheckComboBox 并同时设置 DisplayMemberPath 和 ItemTemplate
- 运行程序 -> 异常
- 将 CheckBomboBox 移动到 DataGridTemplateColumn 的 CellTemplate 再次运行 -> 正常
Expected behavior
No response
Screenshots
No response
NuGet package version
HandyControls (Custom version) 3.6.0
IDE
Visual Studio 2026
Framework type
.Net 10.0
Windows version
Windows 11
Additional context
No response
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from HandyOrg/HandyControl
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
HandyOrg/HandyControl#1818 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
HandyOrg/HandyControl#1809 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
HandyOrg/HandyControl#1820 ·
-
不能够独立的引入用户认为需要的部分Open
Difficulty 4/5 3-5 days Newbie friendliness 48/100
HandyOrg/HandyControl#1816 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
HandyOrg/HandyControl#1813 ·
All issues in HandyOrg/HandyControl
Similar issues
-
[Doc Gap] Document new --enable-public-network-access breaking change for azurebackup vault createOpencopilot documentation
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
area-dashboard
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
0 - Backlog Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
BrighterCommand/Brighter#4539 ·
Maintainers usually reply within 1 day
-
area-networking
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dotnet/aspnetcore#69671 · 1 comment ·
Maintainers usually reply within 1 day
-
test
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NethermindEth/nethermind#14274 ·
Maintainers usually reply within 1 day