从Silverlight 2 Beta 2升级到Silverlight 2 RC0

2016-08-20 10:52:05来源:http://dotfun.blog.51cto.com/663391/285780作者:dotfun人点击


This topic discusses the changes made to the Silverlight runtime and Silverlight tools between the Microsoft Silverlight 2 Beta 2 and the final release of Silverlight 2. The changes discussed in this article are focused on changes that might cause your older Silverlight-based applications to now fail or behave differently, not on new features/enhancements for this release.
Note Corrections/Additions to this document (if any) are listed here.
Note Applications built with Beta 2 will not run on final runtime builds. End users will see a message informing them that the application was built with an obsolete version of Silverlight. You must rebuild your Beta 2 applications – see here for more information.
Tip Given the large number of API changes, particularly those listed in the Miscellaneous API Changes section, you may want to search this document by using CTRL+F.

Contents:
· Important! Migrating Older Code to the Newer Release
· ContentPresenter now derives from FrameworkElement instead of Control
· Layout Rendering Slightly Changed
· Cross domain hosts of Silverlight must set the right MIME type for XAP (application/x-silverlight-app)
· Exceptions now thrown in HttpWebRequest.EndGetResponse()
· Font URI is Restricted to Assembly Resource
· Browser.HtmlElementCollection replaced with by Browser.ScriptObjectCollection
· Exceptions When Changing Some Properties on an Active Animation
· System.Windows.Controls.Extended.dll renamed to System.Windows.Controls.dll
· VisualStateManager Changes
· KeyDown Sent Synchronously
· MeasureOverride/ArrangeOverride on Canvas Now Sealed
· UriTypeConverter moved to System.dll
· HtmlPage.UnregisterScriptableObject Removed
· RenderingEventArgs Changes
· ContentPresenter and ContentControl Changes
· Removal of FileDialogFileInfo Type and OpenFileDialog.SelectedFile(s) Properties
· Removal of FullAccess Option on the ExternalCallersFromCrossDomain attribute in the Silverlight 2 application manifest
· KeyFrameCollection Changes
· Request stream must be closed before calling HttpWebRequest.BeginGetResponse()
· HtmlWindow references on Safari/Mac will no longer evaluate to true
· Address property removed from all WebClient EventArg classes
· Constructors Made Internal
· Exception type change for System.Xml exception type
· Cannot create classes in XAML that do not have accessible constructors
· Get AG_E_UNKNOWN_ERROR in Silverlight 2 but not in Silverlight 1
· Platform looks for generic.xaml as a resource at themes/generic.xaml
· HTTP Polling Duplex OM Changes and Reengineering
· Breaking change to Silverlight native hosting IXcpControl COM interface
· Content-Type is allowed on cross domain request by default
· Enforcing delegate type check when two delegate objects are combined
· Miscellaneous API Changes

Important! Migrating Older Code to the Newer ReleaseIf you are migrating Silverlight applications that were created for the Silverlight 2 Beta 2 release or earlier to the final release of Silverlight 2, you are going to need to get the newest Silverlight 2 Tools for Visual Studio 2008 and recompile your project(s).
1. Get the newest version of Silverlight 2 Tools for Visual Studio 2008. You can get these tools from the SDK or online at Getting Started. You may have to uninstall any old tools before doing this install.
2. Open your old project (e.g. .csproj file). A dialog will come up notifying you that your project was created with an older version of Silverlight tools and asks you if you want to upgrade your project. Click the Yes button.
3. Open all of the HTML files and change:
· The Silverlight MIME type from application/x-silverlight-2-b1 or application/x-silverlight-2-b2 to application/x-silverlight-2.
· The Silverlight installation URL from http://go.microsoft.com/fwlink/?LinkID=108182 or http://go.microsoft.com/fwlink/?LinkID=115261 to http://go.microsoft.com/fwlink/?LinkID=124807.
Note: some templates replaced http://go with http://go2. Be sure to search for both.
4. Debug. Many of the breaking changes you are likely to encounter can be found in this document.

ContentPresenter now derives from FrameworkElement instead of ControlWho Is Affected: Applications that use ContentPresenter or objects derived from ContentPresenter.
Summary
Because ContentPresenter now derives from FrameworkElement, the following properties are no longer exposed by ContentPresenter:
· Background
· BorderBrush
· BorderThickness
· DefaultStyleKey
· FontFamily
· FontSize
· FontStretch
· FontStyle
· FontWeight
· Foreground
· HorizontalContentAlignment
· IsEnabled
· IsTabStop
· Padding
· TabIndex
· TabNavigation
· Template
· VerticalContentAlignment

In addition, some APIs were removed from ContentPresenter (see ContentPresenter and ContentControl Changes).

Fix Required
Remove all these obsolete properties from your ContentPresenter objects, which will likely require you to re-work some of your code to restore your previous UI rendering.


Layout Rendering Slightly ChangedWho Is Affected: All content using layout might be rendered slightly differently because layout no longer causes elements to be rendered at sub-pixel locations.

Summary
The layout system in Silverlight has been modified to round final measure and arrange values to integers when placing elements on the screen (“pixel snapping”). The result is crisper lines, more consistent rendering look, and fewer rendering artifacts.

Layout rounding will be *on* by default, but there is a new inherited property on UIElement called UseLayoutRounding that can be set to false if the old layout behavior is desired.

Note It is possible that this change will affect how your animations render, in which case you might want to set UseLayoutRounding to false.
Note This change does not affect transforms. If you apply a transform to an element, it may still be rendered at a sub-pixel location.

Cross domain hosts of Silverlight must set the right MIME type for XAP (application/x-silverlight-app)Who Is Affected: Anyone serving Silverlight 2 apps from cross domain:
· Via a web server that is not IIS7
· Via a web server where the MIME type for .XAP files is incorrectly configured
Summary/Fix Required
When the XAP is served from a different domain than the host HTML page, Silverlight will validate that the MIME type (Content-Type response header) returned on the HTTP response is application/x-silverlight-app.

Apache (and perhaps other servers) tend to serve unrecognized content as text/plain, and therefore will be affected by this change. You are required to add an entry for the Silverlight XAP MIME type to your .htaccess file -- e.g. AddType application/x-silverlight-app xap.

Note IIS7 shipped with the right MIME type configurations for Silverlight XAPs. No action is required if you are using IIS7.
Exceptions now thrown in HttpWebRequest.EndGetResponse()Who Is Affected: Silverlight 2 applications that use HttpWebRequest.
Summary/Fix Required
For HttpWebRequest:
Before:
· Some security exceptions (e.g. cross-scheme violations) were being raised in HttpWebRequest.BeingGetResponse()
· All other request error conditions were being returned as 404s.

Now:
· Error conditions are now raised as exceptions in HttpRequest.EndGetResponse().
· Request security errors (e.g. requests not allowed by cross domain policy) raise SecurityExceptions
· Non-successful requests (e.g. those that returned 404s) raise WebExceptions. The WebException.Response is set to HttpStatusCode.NotFound. This is compatible with the desktop.
Font URI is Restricted to Assembly ResourceWho Is Affected: Silverlight 2 Beta1 or Beta 2 applications (not Silverlight 1.0 applications) that reference fonts (or zip of fonts) via the URI syntax in the Control.FontFamily, TextBlock.FontFamily or Glyphs.FontUri attributes and where the fonts are not embedded within the assembly (dll) of the control or application.
Fix Required
You can specify a font (or in some cases a zip of fonts) in URI format via the Control.FontFamily, TextBlock.FontFamily and the Glyphs.FontUri attributes. If you are, you will need to ensure your font is marked as a "resource" in the project system.
Browser.HtmlElementCollection replaced with by Browser.ScriptObjectCollectionWho Is Affected: Silvlierlight 2 Beta 2 applications using HTML bridge’s HtmlElementCollection will break. The type has been replaced with a new type: ScriptObjectCollection.
Summary
The System.Windows.Browser.HtmlElementCollection type was changed to ScriptObjectCollection. All previous references to HtmlElement on the collection have been changed to instead reference ScriptObject. Other areas of the HTML bridge that previously used HtmlElementCollection (i.e. HtmlElement.Children) have been switched to instead return a ScriptObjectCollection. Note that if you retrieve an item from the new ScriptObjectCollection that actually is an HtmlElement, you can still cast the return value back to an HtmlElement.
The specific benefit from this change is that across all browsers you can now access both element, and non-element, DOM nodes contained in a node collection. We made this change because there is no consistent cross-browser implementation of an HtmlElement-specific collection type.
Fix Required
Change existing references to HtmlElementCollection to ScriptObjectCollection. If your existing code was working with HtmlElement return values you will need to explicitly cast the items returned from a ScriptObjectCollection to an HtmlElement. Since the collection type is now ScriptObjectCollection it is likely that on different browsers the ordinality of the resulting collection will also change. Any code that was relying on fixed offsets into the collection may need to be changed to account for non-element nodes (e.g. text nodes such as whitespace, etc…) in the collection.
Beta 2
[c#]
HtmlElement myHtmlElement = someOtherHtmlElement.Children[5];

Release
[c#]
HtmlElement myHtmlElement = (HtmlElement)someOtherHtmlElement.Children[5]; //assuming the desired element is still at offset 5

Exceptions When Changing Some Properties on an Active AnimationWho Is Affected: Silverlight 1.0 and 2.0 applications that change properties on active animations.
Summary
When you change one of the properties listed below on an active Storyboard, an exception is raised at runtime with this message: “Operation is not valid on an active Animation or Storyboard. Root Storyboard must be stopped first."
The list of properties that cannot be modified on an active animation or Storyboard are listed below:
Attached Properties· Storyboard.TargetNameProperty
· Storyboard.TargetPropertyProperty
Properties on derived classes from Timeline of a collection type· Storyboard.Children (you cannot add/remove animations from an active storyboard)
· ColorAnimationUsingKeyFrames.KeyFrames
· DoubleAnimationUsingKeyFrames.KeyFrames
· PointAnimationUsingKeyFrames.KeyFrames
· ObjectAnimationUsingKeyFrames.KeyFrames
Make sure you stop the Storyboard before changing one of these properties. You can do this by using the Storyboard.Stop method.
System.Windows.Controls.Extended.dll renamed to System.Windows.Controls.dllWho Is Affected: Anyone who uses the extended controls (Calendar, DatePicker, TabControl and GridSplitter).
Fix Required
Change all references from System.Controls.Extended to System.Windows.Controls and recompile your application.
VisualStateManager ChangesWho Is Affected: Silverlight 2 applications that use VisualStateManager.
Summary
VisualTransition.Duration has changed to VisualTransition.GeneratedDuration. This value will now only affect the generated transitions, and not the VisualTransition.Storyboard.

Example:
In the below XAML, the VSM generated animations for the Pressed-> Normal transition will be created with 1 second durations. The explicit transition Storyboard with its blue ColorAnimation will still be 2 seconds.
[xaml]
<vsm:VisualStateGroup x:Name="CommonStateGroup">
...
<vsm:VisualStateGroup.Transitions>
...
<vsm:VisualTransition From="Pressed" To="Normal" GeneratedDuration="0:0:1">
<Storyboard>
<ColorAnimation Storyboard.TargetName="MainRect" Duration="0:0:2"
Storyboard.TargetProperty="Fill" SpeedRatio="2" To="Blue"/>
</Storyboard>
</vsm:VisualTransition>
</vsm:VisualStateGroup.Transitions>

</vsm:VisualStateGroup>

VisualStateManager.CustomVisualStateManager should be set on the root visual of the ControlTemplate or UserControl, not the Control/UserControl itself. In the example below, the custom visual state manager is set on the Grid, the ControlTemplate’s root visual.
[xaml]
<ControlTemplate TargetType="local:CheckBox">
<Grid x:Name="RootElement" HorizontalAlignment="Center"
VerticalAlignment="Center" Background="Transparent">

<vsm:VisualStateManager.CustomVisualStateManager>
<local:MyVisualStateManager>
</vsm:VisualStateManager.CustomVisualStateManager>

...

</Grid>
</ControlTemplate>

KeyDown Sent SynchronouslyWho Is Affected: If you previously have been doing operations in the KeyDown event that could cause reentrancy into the Silverlight control, such as calling into the HtmlPage.Window.Alert function, this will no longer be supported.
Summary
We switched over our keyboard handling for character input to use the concept of the WM_CHAR windows message. This is used for TextBox/PasswordBox text entry to enable scenarios such as entering AltGr keystrokes. In order for us to do this, the KeyDown event had to be sent synchronously for managed code.

MeasureOverride/ArrangeOverride on Canvas Now SealedWho Is Affected: Silverlight 2 Beta 2 Applications that use MeasureOverride and ArrangeOverride on Canvas.
Summary
MeasureOverride and ArrangeOverride virtual methods on Canvas are sealed. These methods were already sealed for Grid and StackPanel. Any custom panel that requires its own layout logic should subclass Panel.
UriTypeConverter moved to System.dllWho Is Affected: Silverlight 2 managed code referencing the UriTypeConverter class.
Fix Required
UriTypeConverter was moved from System.Windows.Controls.dll to System.dll where it resides on the desktop framework. Applications that reference it just need to be recompiled.
HtmlPage.UnregisterScriptableObject RemovedWho Is Affected: Those using HtmlPage.UnregisterScriptableObject.
Fix Required
Alternative to using HtmlPage.UnregisterScriptableObject, developers can now re-use the same script registration key for RegisterScriptableObject. This allows developers to change the underlying managed object associated with a scriptable entry point.
RenderingEventArgs ChangesWho Is Affected: Silverlight 2 managed code referencing the RenderingEventArgs class.
Summary
The following changes have been made to class RenderingEventArgs
· RenderingEventArgs is moved from System.Windows to System.Windows.Media
· RenderingEventArgs.ctor() is now internal
· System.Windows.RenderingEventHandler has been removed.
ContentPresenter and ContentControl ChangesWho Is Affected: Silverlight 2 managed code that uses either the ContentPresenter or ContentControl classes.
Summary
The following properties were removed from ContentPresenter and ContentControl.
· TextAlignment
· TextDecorations
· TextWrapping
Removal of FileDialogFileInfo Type and OpenFileDialog.SelectedFile(s) PropertiesWho Is Affected: Silverlight 2 applications which use the OpenFileDialog.
Summary
· The System.Windows.FileDialogFileInfo type is being removed. Its functionality is now being exposed via its base System.IO.FileInfo type to transparent code within Silverlight’s sandbox.
· System.Windows.Controls.OpenFileDialog has a couple properties which consume and expose FileDialogFileInfo. They were modified to return the FileInfo type.
· In addition, the property names SelectedFile and SelectedFiles were also changed to File and Files.

Fix Required
Beta 2
[c#]
// Returns a File object for the selected file. If multiple files are selected, returns the first selected file
public FileDialogFileInfo SelectedFile { get; }

// Returns a collection of File objects for the selected files
public IEnumerable<FileDialogFileInfo> SelectedFiles { get; }

Release
[c#]
// Returns a File object for the selected file. If multiple files are
// selected, returns the first selected file
public FileInfo File { get; }

// Returns a collection of File objects for the selected files
public IEnumerable<FileInfo> Files { get; }

Sample usage of OpenFileDialog with this change:
[c#]
openFileDialog = new System.Windows.Controls.OpenFileDialog();
openFileDialog.Multiselect = false;
openFileDialog.Filter = "Text Files (*.txt)|*.txt|All files (*.*)|*.*";

bool? retval = ofd.ShowDialog();
if (retval != null && retval == true) {

// Get the filename
string filename = openFileDialog.File.Name;
// Open the file
System.IO.Stream filestream = openFileDialog.File.OpenRead();

// Do something with the filestream

// Close it
}


Removal of FullAccess Option on the ExternalCallersFromCrossDomain attribute in the Silverlight 2 application manifestWho Is Affected: Only Silverlight 2 applications that use this combination of features:
· XAP deployed on a different domain than the host HTML page, and
· with application manifest (AppManifest.xaml) specifying ExternalCallersFromCrossDomain=”FullAccess” on the root element are affected.
Summary
The ability for arbitrary scripts to walk the element tree, register for and get notified on events, and use the Silverlight 1.0 Downloader from script has been curtailed in a cross-domain app deployment scenario. The application manifest previously supported the ability for app author to designate the ExternalCallersFromCrossDomain attribute with the values NoAccess (default in cross-domain), ScriptableOnly and FullAccess. Support for the FullAccess option has been removed.
Many of the purposes you would have relied on the FullAccess option can now be fulfilled via the Scriptable object feature, with minor additional work on your part.

KeyFrameCollection ChangesSummary and Fix
Virtual methods Add, Contains, Indexof, Insert, Remove, get_Item, set_Item are no longer declared on the following collections:
· ColorKeyFrameCollection.
· DoubleKeyFrameCollection
· ObjectKeyFrameCollection
· PointKeyFrameCollection
· PointKeyFrameCollection
· StrokeCollection

Request stream must be closed before calling HttpWebRequest.BeginGetResponse()Who Is Affected: Silverlight 2 applications that use HttpWebRequest.BeginGetResponse().
Summary
You must close the request stream on an HttpWebRequest before calling BeginGetResponse(). Previously BeginGetResponse() would close an open request stream.

HtmlWindow references on Safari/Mac will no longer evaluate to trueWho Is Affected: Code that uses System.Windows.Browser.HtmlWindow and that expects two HtmlWindow references pointing at the same DOM window to evaluate to true will now return false when running on Safari 2 or Safari 3 on Mac.
Summary
For example:
· Create a page with one iframe
· Use the bridge to get two references to the iframe:
HtmlWindow myWin = document.GetElementById(“myIframe”);
HtmlWindow myWin2 = document.GetElementById(“myIframe”);
· With the change the following comparison will now return false on Safari 2/3 Mac:
bool areEqual = (myWin == myWin2);



Address property removed from all WebClient EventArg classesFix Needed
If you were depending on the Address property, you can work around this breaking change in the following way:
Beta 2
[c#]
void Callback(object sender, DownloadStringCompletedEventArgs args)
{
DebugPrint(args.Address.ToString());
}

void MakeCall(Uri uri, object userState)
{
webClient.DownloadStringAsync(uri, userState);
}

Release
[c#]
class DownloadState
{
public DownloadState() {}
public Uri Address;
public object ActualUserState;
}

void Callback(object sender, DownloadStringCompletedEventArgs args)
{
DownloadState userState = (DownloadState)args.UserState;

DebugPrint(userState.Address.ToString());
}

void MakeCall(Uri uri, object userState)
{
Uri absoluteUri = uri;
if (absoluteUri.IsAbsoluteUri == false)
{
absoluteUri = new Uri(new Uri(webClient.BaseAddress), absoluteUri);
}

DownloadState downloadState = new DownloadState();
downloadState.Address = absoluteUri;
downloadState.ActualUserState = userState;

webClient.DownloadStringAsync(uri, downloadState);
}



Constructors Made InternalSummary
You can no longer create the objects listed below because their associated constructors have been made internal:
· SizeChangedEventArgs
· TextChangedEventArgs
· DownloadProgressEventArgs
· ExceptionRoutedEventArgs
· KeyEventArgs
· MouseButtonEventArgs
· MouseEventArgs
· StartupEventArgs
· Expression
· GeneralTransform
· Geometry
· ImageSource
· PathSegment
· SetterBase
· Transform
· BindingExpressionBase
· InputMethod

Exception type change for System.Xml exception typeSummary
In the methods/constructors shown below, we will no longer be checking for null arguments. As a result, the usage of null arguments will result in a NullReferenceException. In previous builds of Silverlight, use of a null argument would result in an ArgumentNullException being thrown. There is no change in functionality, just the type of exception that is being thrown.
· XmlReader.IsName method
· XmlReader constructor
· XmlReader.MoveToAttribute method
· XmlReader:IsNameToken method
· XmlNamespaceManager constructor
· XmlReader.Nametable.Add method
· XmlReader.Nametable.Get method
· XmlCharCheckingWriter.WriteQualifiedName method
· XmlCharCheckingWriter.WriteDocType method
· XmlConvert.ToBoolean method
· XmlConvert.ToDouble method
· XmlConvert.ToSingle method
· XmlConvert.ToDateTime method

Cannot create classes in XAML that do not have accessible constructorsSummary
Certain classes that were defined by the Silverlight runtime were creatable in XAML, even though they did not have an accessible constructor. With this change, you can no longer instantiate those classes in XAML.
These classes (which only have internal constructors) can no longer be created in XAML:
· TriggerCollection
· InlineCollection
· RowDefinitionCollection
· ColumnDefinitionCollection
· RoutedEventARgs
· MouseButtonEventArgs
· KeyEventARgs
· ErrorEventArgs
· UIElementCollection
· Downloader
· InternalWebRequest
· MultiScaleSubImageCollection
· MediaAttribute
· MediaAttributeCollection
· ExceptionROutedEventArgs
· DownloadProgressEventArgs
· StartupEventArgs
· TextBoxBase
· TextBoxView
· TextChangedEventArgs
· RuntimeHostEventArgs
· SizeChangedEventArgs
· RenderingEventArgs
· ItemCollection
· CorePropertyChangedEventArgs
· IsEndabledChangedEventARgs
· TypeProxy
· ManagedObjectReference
· AutomationPropertiesEnum
· DependencyPropertyProxy

Get AG_E_UNKNOWN_ERROR in Silverlight 2 but not in Silverlight 1Summary
In previous versions of Silverlight, when media failed because a media file was not available, a MediaFailed event was fired but if the MediaFailed event was not handled by the developer, the end user would not be notified of the failure. Now when a handler is not hooked up to the MediaFailed event, the error bubbles up to the default OnError handler of the plug-in and AG_E_UNKNOWN_ERROR is displayed to the user.
Fix Required
Attach the MediaFailed event to your MediaElement objects and handle errors as appropriate.

Platform looks for generic.xaml as a resource at themes/generic.xamlSummary
The platform now looks for the generic.xaml resource dictionary as an assembly resource in the "themes" directory rather than the root directory.
Fix Required
Move your generic.xaml resource underneath the "themes" folder under ControlLib in Solutions Explorer in Visual Studio.

HTTP Polling Duplex OM Changes and ReengineeringWho Is Affected: This will impact anyone using the HTTP Polling Duplex channel.
Summary
· PollTimeout setting on the server side (PollingDuplexHttpBinding and PollingDuplexBindingElement) has been renamed to ServerPollTimeout
· PollTimeout setting on the PollingDuplexBindingElement (client side) has been renamed to ClientPollTimeout.
· PollTimeout setting on the PollingDuplexHttpBinding (client side) has been cut. In most scenarios, it should not be necessary to change this. If a change is necessary, it can be achieved through the ClientPollTimeout on the PollingDuplexBindingElement.
· Client-side support has been cut from the non-Silverlight (server-side) polling duplex assembly (i.e. BuildChannelFactory will throw a NotSupportedException). That is, in RTM, the client side for polling duplex must be Silverlight (and the server side must be the regular .NET Framework, but this restriction was already in place in Beta2).
· Default timeouts have been changed for the Duplex channel. For most common scenarios, the new out-of-the-box defaults should be appropriate and there is no need to change them.
· An error (404) on a polling request will cause the duplex channel to fault.
· Various invalid messages used to be ignored by the Duplex stack but will now be rejected.
· If any HTTP error (404,500,…) is encountered during a SOAP call, a CommunicationException is now thrown instead of a ProtocolException.

Breaking change to Silverlight native hosting IXcpControl COM interfaceWho Is Affected: Applications that host Silverlight 2 natively via its COM APIs.
Summary
· The following splash screen related properties added to IXcpControl interface are being broken out and being moved to a new IXcpControl2 interface:
· get_OnSourceDownloadComplete
· get_OnSourceDownloadProgressChanged
· get_SplashScreenSource
· put_OnSourceDownloadComplete
· put_OnSourceDownloadProgressChanged
· put_SplashScreenSource

In addition, the LoadRuntime function is also being moved to IXcpControl2.

Content-Type is allowed on cross domain request by defaultSummary
Both supported cross domain policy files (crossdomain.xml, clientaccesspolicy.xml) no longer need to explicitly allow the Content-Type request header. The Content-Type header is always settable on POST xdomain requests, as long as the request itself is allowed by a cross domain policy file.
In addition, the LoadRuntime function is also being moved to IXcpControl2.

Fix Required
Previously you needed to specify Content-Type in the headers whitelist. Now, Content-Type is always allowed, so the bolded “Content-Type” attribute value is no longer required just for setting the Content-Type (see below).
clientaccesspolicy.xml
Old version that explicitly listed Content-Type as settable. (This file still works in SL2 RTM.)
[xaml]
<?xml version="1.0"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="Content-Type, SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
New version that still allows Content-Type to be set
[xaml]
<?xml version="1.0"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="SOAPAction">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource include-subpaths="true" path="/"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>

crossdomain.xml
Old version that explicitly listed Content-Type as settable. (This file still works in SL2 RTM.):
[xaml]
<?xml version="1.0"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="* " />
<allow-http-request-headers-from domain="* " headers="Content-Type, SOAPAction" secure="true" />
</cross-domain-policy>

New version that still allows Content-Type to be set:
[xaml]
<?xml version="1.0"?>
<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="* " />
<allow-http-request-headers-from domain="* " headers="SOAPAction" secure="true" />
</cross-domain-policy>

Enforcing delegate type check when two delegate objects are combinedWho Is Affected: Code that bypass the delegate type check in Delegate.Combine by calling MulticastDelegate.CombineImpl directly.
Fix Required
If you want to combine two delegate objects they should be of the exact same delegate type.

Miscellaneous API Changes· UIElement.HitTest method has moved to the VisualTreeHelper class and renamed to VisualTreeHelper.FindElementsInHostCoordinates.
· Moved DependencyPropertyChangedEventHandler delegate type from System.Windows.Controls to System.Windows namespace.
· Control.IsTabStop defaults to true. Now, all Control derived classes (directly or indirectly) have IsTabStop set to true except, UserControl, HyperlinkButton, ScrollViewer and ListBox.
· WebHeaderCollection.Keys property was replaced with the AllKeys property.
· WebHeaderCollection.Headers property was renamed to Keys.
· WebRequest.RegisterPrefix() now returns false in failure cases per the interface contract from the desktop framework rather than throwing an exception.
· WebResponse.Dispose(bool explicitDisposing) was removed.
· Deployment.PartProperty is now read only.
· Deployment.EntryPointAssemblyProperty is now read only.
· Deployment.EntryPointTypeProperty is now read only.
· Deployment.RuntimeVersionProperty is now read only.
· Deployment.ExternalCallersFromCrossDomainProperty is now read only.
· Thumb.IsDragging is now read only.
· Slider.IsFocused is now read only.
· ButtonBase.IsFocused is now read only.
· ButtonBase.IsMouseOver is now read only.
· ButtonBase.IsPressed is now read only.
· ToolTipService.GetToolTip is now private.
· IRawElementProviderSimple is now sealed and has a private default constructor.
· Setter.PropertyProperty is now internal. Please use the CLR property instead of the DependencyProperty.
· Slider.UpdateTrackLayout() is now internal.
· Slider.OnOrientationChanged() is now internal.
· Slider.OnIsFocusChanged(DependencyPropertyChangedEventArgs e) is now internal.
· ComboBox.get_IsSelectionActive() is now internal.
· ComboBox.ScrollIntoView(Int32 index) is now internal.
· ComboBox.get_SelectionBoxItemTemplate() now returns System.Windows.DataTemplate.
· PasswordBox.SelectionChanged is now private.
· MouseEventArgs.Handled was moved to MouseButtonEventArgs.
· RenderTargetBitmap was renamed to HostingRenderTargetBitmap and moved from System.Windows.Media.Imaging to namespace System.Windows.Interop.
· AutomationPeer constructor is now protected.
· TriggerActionCollection.Item now takes System.Windows.TriggerAction instead of System.Windows.Media.Animation.BeginStoryboard.
· TriggerCollection.Item now takes System.Windows.TriggerBase instead of System.Windows.EventTrigger.
· RoutedEventArgs.Source was renamed to OriginalSource and is now read-only.
· ITableItemProvider and ITableProvider are now derived from IGridItemProvider and IGridProvider.
· The KeyboardNavigation class is now internal.
· ColumnDefinitionCollection constructor was made internal.
· InlineCollection constructor was made internal.
· ItemCollection constructor was made internal.
· RowDefinitionCollection constructor was made internal.
· UIElementCollection constructor was made internal.
· TriggerCollection constructor was made internal.
· Listbox field ListBoxItem._itemsControl is now internal.
· Ink.Stroke constructor changed to ctor(System.Windows.Input.StylusPointCollection).
· CanConvertFrom(Type sourceType) changed its signature to CanConvertFrom(ITypeDescriptorContext context, Type sourceType).
· CanConvertTo(Type destinationType) changed its signature to CanConvertTo(ITypeDescriptorContext context, Type destinationType).
· ConvertFrom(object value) changed its signature to ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value).
· ConvertFromString(string text) now is ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) where value of type string.
· ConvertTo(object value, Type destinationType) changed its signature to ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType).
· ConvertToString(object value) now is ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) with destinationType of type string.
· ItemCollection constructor is no longer available so any code that tries to instantiate an ItemCollection directly will no longer compile. This class is supposed to be instantiated only within ItemsControl.
· ContentPresenter now derives from FrameworkElement instead of Control.
· Control.OnIsEnabledChanged was removed. Now use IsEnabledChanged for extended controls.
· DownloadProgressEventHandler was removed.
· The following converters were removed:
· TextDecorationCollectionConverter
· FontStretchConverter
· FontStyleConverter
· FontWeightConverter
· FontFamilyConverter

部分翻译:


从Silverlight Beta 2升级到Silverlight RC0这里主要介绍了从Silverlight 2的Beta 2版本和最后的RTM版本之间做了一些关于Silverlight运行时和 Silverlight工具上的的变化。在这篇文章介绍Silverlight的变化在可能会引起你的旧版本Silverlight应用程序到现在RC0的上运行失败或错误的内容表现,并声明在Silverlight的最终版发布后不会有新的特性和增强。
注意: 修改/增加后的内容请查看这个文档 <http://go.microsoft.com/fwlink/?LinkId=119604>.注意: 安装Beta 2用户运行RC版本应用程序时,终端用户将看见一条消息通知他们应用程序是由 Silverlight 的一个过时的版本被创建。你必须重建你的 Beta 2 应用程序 。


最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台