How do I resolve the error: value of type cannot be added to a collection or dictionary of type 'UIElementCollection'

4587
0
09-25-2015 09:12 AM
Labels (1)
ChrisSergent
Regular Contributor III

I have a xaml file with the following code and I receive an error for my local:TextEditorToolbar:

Window x:Class="TextEditor.MainWindow"


xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"


xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"


xmlns:local="clr-namespace:TextEditor"


Title="Text Editor" Height="600" Width="800">


<DockPanel>


<Menu x:Name="menu"


DockPanel.Dock="Top"/>



<StackPanel>


<local:TextEditorToolbar x:Name="toolbar"/>


</StackPanel>



<StatusBar DockPanel.Dock="Bottom">


<TextBlock x:Name="status" />


</StatusBar>


<RichTextBox x:Name="body"


SpellCheck.IsEnabled="True"


AcceptsTab="True"


AcceptsReturn="True"


BorderThickness="0 2 0 0" />


</DockPanel>

Window>


It references a user control name TextEditorToolbar.xaml. Why would I receive this error and how do I fix it.

0 Kudos
0 Replies