说明: 提供了部分Silverlight控件的实现源码,有利于深入了解控件的工作本质 (Silverlight offers some of the implementation of source control is beneficial to understanding the nature of work control)
文件列表:
Silverlight 2 Control Sample Source Code and Apps (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\App.xaml (524, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\App.xaml.cs (2456, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Bin (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Bin\Debug (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\ControlsSample.csproj (4211, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\ControlsSample.csproj.user (942, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\obj (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\obj\Debug (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Page.xaml (1323, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Page.xaml.cs (699, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Properties (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Properties\AppManifest.xml (207, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\ControlsSample\Properties\AssemblyInfo.cs (1635, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Bin (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Bin\Debug (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Button.cs (2793, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\CheckBox.cs (2529, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\ClickMode.cs (954, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\HyperlinkButton.cs (7826, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\obj (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\obj\Debug (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Orientation.cs (637, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives (0, 2010-01-22) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\ButtonBase.cs (24678, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\DragCompletedEventArgs.cs (2874, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\DragDeltaEventArgs.cs (2374, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\DragStartedEventArgs.cs (2284, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\IScrollInfo.cs (3464, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\RangeBase.cs (17813, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\RepeatButton.cs (16063, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\ScrollBar.cs (31536, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\ScrollEventArgs.cs (2117, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\ScrollEventType.cs (2241, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\Thumb.cs (15092, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\Primitives\ToggleButton.cs (10658, 2008-11-05) Silverlight 2 Control Sample Source Code and Apps\Runtime Controls\SilverlightControls\ProgressBar.cs (8227, 2008-11-05) ... ...
Layout
------
### NB: Some of the changes are to accomodate an Out-of-Memory condition that exists due to known memory leaks. See the
### notes regarding the TestClasses folder. Once the leaks are fixed, this may be adjusted for time, rather than memory.
In an attempt to maximize the possible conditions we can test against, the unit tests have been refactored to allow us to
combine sequence types with element types and cardinalities, and to run them against a common set of unit tests as appropriate.
The new files have been organized as follows, and may be adjusted pending further work on the testing infrastructure itself.
DataClasses\
: the types of individual items in the data source. For example, Customer.
- In general, it's preferable to add properties to DataTypes or Customer, without creating anything new.
DataClassSources\
: the types of the data sources. For example, zero-, one-, and many-item sequences
: (IList, IEnumerable, etc) of the DataClass types. These sources allow us to emphasize
: the interfaces of collections, rather than silently depend on, for example, List when we
: really want to test IList (and where we may provide shortcuts internally for users of
: List).
- Like data types, data sources multiply the number of tests greatly, so avoid creating a new data source if it's
sufficient to adjust an existing one without invalidating anything. New sources should derive from
DataClassSource (or GenericDataClassSource) where TDataClass: new(), call base(n) in
their constructor, and use the inherited Items property to fetch a randomly-generated sequence (constant for
the lifetime of the data source instance) of TDataClass objects.
For example, a cut-down version of a non-generic list looks like:
public abstract class NonGenericList : DataClassSource, IList
where TDataClass : new()
{
protected NonGenericList(int count)
: base(count)
{
}
#region IList Members
public virtual int Add(object value)
{
this.Items.Add(value);
return this.Items.IndexOf(value);
}
// ...
#endregion
#region ICollection Members
public void CopyTo(Array array, int index)
{
// ### NOTE LINQ Cast OPERATOR
this.Items.CopyTo(array.Cast