类型“..."的值;无法添加到“uielementcollection"类型的集合或字典中 [英] the value of type "..." cannot be added to a collection or dictionary of type 'uielementcollection'
问题描述
当我通过 XAML 添加自定义控件时出现以下错误.可能的原因是什么?..."类型的值不能添加到uielementcollection"类型的集合或字典中
I am gettig following error when i am adding a custom control thru XAML. what can be the possible reason? the value of type "..." cannot be added to a collection or dictionary of type 'uielementcollection'
<Grid x:Name="QuantityDetail" DataContext="{StaticResource ViewModel}">
<GroupBox>
.....
<Label Style="{StaticResource ResourceKey=LabelValue}">Min</Label>
<!-- The following control -->
<NumericUpDow><NumericUpDown>
.....
</GroupBox>
</Grid>
推荐答案
问题是我没有在我的解决方案中引用一个 dll(由 numericupdown 控件引用).实际上 NumericUpDown 控件不是我的控件,它存在于不同的 dll 中.这个控件引用 System.Windows.Controls.Input.Toolkit.dll.现在我在我的解决方案中引用它.一切顺利
Problem was that i was not referencing to one dll(which is referenced by numericupdown control) in my solution. Actually NumericUpDown control is not my control, its present in different dll. And this control was refereing System.Windows.Controls.Input.Toolkit.dll. Now I am refereing it in my solution. And things are working
这篇关于类型“..."的值;无法添加到“uielementcollection"类型的集合或字典中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!