Template and snippets
Namespaces
To optimize template and snippets rendering, all namespaces need to be declared in the main template. You need to move all the namespaces used in your snippets to the main template. The changes have to be applied on all snippet sets.
Example in 2.3x:
<html xmlns:gwc="http://www.4js.com/GWC" xmlns="http://www.w3.org/1999/xhtml"
...>
<svg:svg
xmlns:svg="http://www.w3.org/2000/svg"
viewBox="0 0 1000 1000"
preserveAspectRatio="none">
<svg:rect x="0" y="0" width="1000" height="1000" fill="lightgray"
stroke="black"/>
<span gwc:repeat="i items" gwc:replace="i" />
</svg:svg>
Example in 2.40:
<html xmlns:gwc="http://www.4js.com/GWC" xmlns="http://www.w3.org/1999/xhtml"
xmlns:svg="http://www.w3.org/2000/svg" ...>
GWC for Silverlight behaviors
Starting with GAS 2.40, GWC for Silverlight follows the Model-View-ViewModel (MVVM) pattern to enable even more designers to customize the view of their applications with tools like Microsoft® Expression Blend.
This change leads to the replacement of the GWC.Behaviors module by a view models layer. Therefore all the XAML markup that used the bhv prefix needs to be updated. Here is an example of the migration of an action view.
<sr:Button
bhv:Action.Observer="{action && action/isActive ?
[action/IDID, 'Activate'] : null}"
bhv:Media.URI="['{resourceURI("images/close.png",
"SetSL")}', 'SmallImage']"
IsEnabled="{action/isActive || false}"
IsTabStop="False" />
<sr:Button
Command="{{Binding ClickCommand,Mode=OneTime}"
SmallImage="{{Binding Image.Source}"
IsEnabled="{action/isActive || false}"
IsTabStop="False">
<sr:Button.DataContext>
<vm:ActionView Image="{resourceURI('images/close.png','SetSL')}">
<vm:ActionView.ServerActions
gwc:condition="action && action/isActive">
<vmsa:Action ServerID="{action/IDID}"
IsEnabled="True" Event="Click" />
</vm:ActionView.ServerActions>
</vm:ActionView>
</sr:Button.DataContext>
</sr:Button>
The bhv:Action.Observer and bhv:Media.URI behaviors have been replaced by a more conventional mechanism based on Data bindings that gets their properties from the ActionView view model.
GWC for Silverlight template snippet splitting
To ease the customization, some template snippets have been splitted into more parts:
- The user interface part of the main.xaml template has been put into the UserInterface.xaml snippet.
- The ending part of the main.xaml template has been put into the EndingPage.xaml snippet.
- The toolbar and the top menu parts of the WindowContent.xaml snippet have been put into the ToolMenu.xaml snippet.