25
votes

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>
2
Can you show how you have IonNumericUpDow defined?ChrisWue

2 Answers

20
votes

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

2
votes

The compiler claims that your control is not an UIElement (i doubt that it is lying), what does your control inherit from?