Udostępnij za pośrednictwem


Warning in Tools about Custom Control

As many people on newsgroup have noticed that there is warning that shows up when you use a custom control in XAML.

Warning 1 The element 'Canvas' in namespace 'https://schemas.microsoft.com/client/2007' has invalid child element 'ListBox' in namespace 'clr-namespace:Silverlight.Samples.Controls;assembly=ClientBin/Silverlight.Samples.Controls.dll'. List of possible elements expected: 'Code' in namespace 'https://schemas.microsoft.com/winfx/2006/xaml' as well as 'Canvas.Clip, Canvas.RenderTransform, Canvas.Triggers, Canvas.OpacityMask, Canvas.Children, Canvas.Resources, Canvas.Background, Path, Ellipse, Line, Polygon, Polyline, Rectangle, Glyphs, TextBlock, Canvas, InkPresenter, MediaElement, Image' in namespace 'https://schemas.microsoft.com/client/2007'. D:\Project\ImageListBox\ImageListBox\Page.xaml 15 4 ImageListBox

This is because Tools for Silverlight Alpha dont yet support custom controls. They do intellisense etc against the fixed schema of known platform elements. Since Custom controls are not known, tools think that it is invalid element to have a child for Canvas.

It is ok to ignore this warning though it is very irritating. I am sure there is a way to tweak the settings around errors and warning but I personally dont think it is worth doing it because it might mask some valid things.