|
| ||||||||||
| Tags: microsoft, silverlight, web application, xaml |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| XAML Processing Differences Between Silverlight 3 and Silverlight 4
Syntactic variations Mixed Elements and proprietary content Silverlight 3 sustains mixed content elements and property in XAML. On the other hand, the Silverlight XAML 4 and [MS-XAML] does not support them. For example, the subsequent XAML code can be scrutinized in Silverlight 3 but not Silverlight 4: Code: X:Name="BorderLayout"> <Grid
<TextBlock>
<TextBlock.Text>
Path="Text" <Binding ElementName="tb" />
</ TextBlock.Text>
</ TextBlock>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</ Grid.RowDefinitions>
X:Name="tb" <textbox Grid.Row="1" /> <! - This is a second content set, invalid in v4 ->
</ Grid> Silverlight 3 supports XAML with elements that do not specify property information XAML namespace of its primary object element. April Silverlight does not support this and throws an analysis of XAML. For example, the following XAML in Silverlight 3 is valid but it is not in Silverlight 4: <Controls: WrapPanel Width = "100" Height = "100"Xmlns attribute false In some cases, 3 supports Silverlight XAML with xmlns attribute-that are not resolved. In such cases, Silverlight 3 uses an object element xmlns reserve. April Silverlight does not support this and throws an analysis of XAML. |
|
#2
| |||
| |||
| Re: XAML Processing Differences Between Silverlight 3 and Silverlight 4 Explicit object element to a collection of read-only collection In Silverlight 3, the properties of a read-only collection may contain an object element for the type of collection. This violates the general principle that an object element creates an instance of type, it would not be valid for a collection of read-only. In this case, Silverlight 3 produces exception analysis. For example, the following code in Silverlight 3 is valid but it is not in Silverlight 4: Code: <DoubleAnimationUsingKeyFrames>
<DoubleKeyFrameCollection>
Value="100" <DiscreteDoubleKeyFrame KeyTime="0:0:2" />
Value="400" <DiscreteDoubleKeyFrame KeyTime="0:0:4" />
</ DoubleKeyFrameCollection>
</ DoubleAnimationUsingKeyFrames> Silverlight Version 3 supports the contents of a string object element only for a few objects, namely TextBlock and Run. Other objects do not support channels of content. For example, <button> Hello </ Button> not valid in Silverlight 3 and should have this format: Content="Hello" <Button />. In Silverlight 4, no such restriction is usually applied. However, should not be construed as any Silverlight control 4 can accept a string of content. The object model determines whether a particular control can accept a string of content or not, this being more important consideration than the consideration of whether it is possible to establish the corresponding property as a string of XAML content. Note that the text initialization string XAML seems content, but not a real chain establishing the XAML content property. Control blanks Silverlight 3 is whitespace in a more literal and more broadly, there are even some cases where CLRF is considered significant. Sometimes this led to a XAML file format with CRLF omitted to avoid unwanted whitespace in the presentation, but that was not legible in editing environments. Silverlight 4 uses a model of significant white space is more intuitive than similar to WPF. This model gets the blanks in the file format in most cases except in the case of certain containers with CLR attributes that deal with all the blanks as significant. This model gives blanks greater freedom to editing environments to enter spaces that improve the XAML format. Also, Silverlight 4 has text elements that allow even greater control of the problems associated with the presentation of the blanks. Entities XAML Silverlight 3 excludes non-existing entities in the namespace of the XAML ( x: ). In this case, Silverlight four exceptions occur if the analysis has no such entity as defined in XAML. Scope of x: Key Silverlight 3 only allows the use of x: Key in the field of ResourceDictionary. Silverlight also supports 4 x: Key element in any application where the type of support implements IDictionary. Performance of x: Name / name fields XAML XAML Object Elements than DependencyObject not support x: Name on the level of syntax Silverlight 3. However, Silverlight 4 accepts the syntax, but may not be able to add the object to XAML namespace. Markup Extensions Except for Binding , markup extensions in Silverlight 3 can only be used in the syntax of attributes, not the object element syntax. Except in the case of Binding , the constructor parameters of these extensions can not dial using the syntax of named parameters. For example, Akey StaticResource () works but StaticResource ResourceKey = () Akey does not work. XAML Namespaces Silverlight 3 obliges the subsequent limitations on the namespace declarations that differ from Silverlight XAML 4:
|
|
#3
| |||
| |||
| Re: XAML Processing Differences Between Silverlight 3 and Silverlight 4 Performance of the compilation of marking or partial classes When using x: Class, Silverlight 3 enables a behavior so that, if you set a property on the subclass of the root element, the property meets the property of the subclass but not exist in the root tag. Silverlight four exceptions occur in this case. The example below works on Silverlight 3 but an exception occurs in Silverlight in April. Code: public class MyPage: UserControl
(
public int Value (get; set;)
) Code: <UserControl x: Class = "SilverlightApplication1.MyPage" ... Value = "17"> </ UserControl> Code: namespace MyNS
(
public class Page: Canvas (etc. etc. )
)
AND
<UserControl x: Name = "parentCanvas" x: Class = "MyNS.Page" ... /> In the following sections, analytical assessments and searched the support code that are managed differently in Silverlight 3 and Silverlight 4. Duplicate sets of properties In some cases, you can set the same property several times in the XAML for Silverlight 3 if it is a basic property is not only non-native implementation. April Silverlight does not allow it at all, and throws an analysis of XAML. Evaluate enumeration values When Silverlight 3 analyzes an enumeration with a text value initialization, generates an integer value. Silverlight in April, however, generates the enumeration value. This is important if you access the values in the underlying code, or enumerations are evaluated in the user interface. However, in general, the latter procedure is not recommended. Check rates for the TypeConverter classes or Storyboard Silverlight three visual states accept other than Storyboard, and classes with attributes TypeConverterAttribute than TypeConverter. In both cases, it is likely that problems in run time. However, it is accepted in the XAML markup for the compilation and loading. Silverlight four throws an exception in these cases. Support of adjoining properties XAML can be used attached properties with only a static setter. In Silverlight 4, these properties require a getter and a setter static static. Also, Silverlight 3 is a specific requirement: the adjoining properties must be implemented to support dependency properties. Silverlight 4 does not have this restriction. Search StaticResource from the attributes of a link Silverlight 3, an object subproperties Binding making a reference to an error StaticResource not produce any exception during parsing of XAML. The link subproperty acts as if that was not established. It is a typical behavior of StaticResource and may interfere with the purification of a link. Silverlight four throws an analysis for sub-properties of an object Binding which refer to StaticResource that generates an error. System Primitives The only compatible constructs a namespace System assigned, the combination of the assembly mscorlib in Silverlight ( which is normally assigned as sys: ) are sys: Double, sys: String, sys: Boolean and sys: Int32. (The intention here is to use the types "primitive" elements defined there as the object, usually for use as a resource in a resource dictionary). Template Behavior
UserControl behavior
|
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "XAML Processing Differences Between Silverlight 3 and Silverlight 4" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Silverlight 5 released; will there be a Silverlight 6? | GopuHD | Windows Software | 4 | 11-01-2012 01:28 PM |
| Silverlight 5 RC now Available | Pa!trick | Windows Software | 3 | 29-09-2011 05:28 AM |
| While installing Silverlight I get "Silverlight is already installed" message | Raja Ram | Windows Software | 5 | 28-04-2011 10:27 AM |
| How to install SilverLight 5 beta and SilverLight 4 on same Computer | Mandarmalika | Windows Software | 3 | 17-04-2011 04:55 PM |
| What is SilverLight? | Champak | Windows Software | 4 | 31-01-2009 09:21 AM |